реагировать нативно Google Signin код ошибки разработчика 10 - PullRequest
1 голос
/ 12 июля 2019

Я пытаюсь использовать вход в Google с помощью Firebase для моего проекта. Я использовал его раньше и добился успеха, но на этот раз я не смог заставить его работать, выполнил все необходимые шаги. Использование реагировать нативно 0,60.

Устранение неполадок на GitHub предлагает добавить signingConfigs в build.gradle, но он уже там. Ключ SHA верный, использовал его в другом проекте и работал нормально, единственное отличие было реагирующим - 0,59

Create new fire base project Choose a Google Cloud Platform (GCP) resource location Set support email Enable Google Auth Added the Web Client ID from Google Auth to project config SHA Key generated with keytool -list -v -alias androiddebugkey -keystore %USERPROFILE%\.android\debug.keystore // Same key worked with other project Placed google-services.json in app/ // Content matches the web client id from page and project config Added all the required code to build.gradle Я не получаю ошибок во время сборки.

// main build.gradle:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext {
        buildToolsVersion = "28.0.3"
        minSdkVersion = 16
        compileSdkVersion = 28
        targetSdkVersion = 28
        supportLibVersion = "28.0.0"
    }
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:3.4.1")
        classpath 'com.google.gms:google-services:4.2.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        mavenLocal()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url("$rootDir/../node_modules/react-native/android")
        }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }

        google()
        jcenter()
    }
}

// уровень приложения build.gradle

...
def enableHermes = project.ext.react.get("enableHermes", false);

android {
    compileSdkVersion rootProject.ext.compileSdkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
        applicationId "com.profitmaster"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 1
        versionName "1.0"
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
        }
    }
    signingConfigs {
        debug {
            storeFile file('debug.keystore')
            storePassword 'android'
            keyAlias 'androiddebugkey'
            keyPassword 'android'
        }
    }
    buildTypes {
        debug {
            signingConfig signingConfigs.debug
        }
        release {
            // Caution! In production, you need to generate your own keystore file.
            // see https://facebook.github.io/react-native/docs/signed-apk-android.
            signingConfig signingConfigs.debug
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
    }
    // applicationVariants are e.g. debug, release
    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            // For each separate APK per architecture, set a unique version code as described here:
            // https://developer.android.com/studio/build/configure-apk-splits.html
            def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
            def abi = output.getFilter(OutputFile.ABI)
            if (abi != null) {  // null for the universal-debug, universal-release variants
                output.versionCodeOverride =
                        versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
            }

        }
    }

    packagingOptions {
        pickFirst '**/armeabi-v7a/libc++_shared.so'
        pickFirst '**/x86/libc++_shared.so'
        pickFirst '**/arm64-v8a/libc++_shared.so'
        pickFirst '**/x86_64/libc++_shared.so'
        pickFirst '**/x86/libjsc.so'
        pickFirst '**/armeabi-v7a/libjsc.so'
    }
}

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.facebook.react:react-native:+"  // From node_modules
    implementation 'com.google.firebase:firebase-core:17.0.0'

    if (enableHermes) {
      def hermesPath = "../../node_modules/hermesvm/android/";
      debugImplementation files(hermesPath + "hermes-debug.aar")
      releaseImplementation files(hermesPath + "hermes-release.aar")
    } else {
      implementation jscFlavor
    }
}

// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.compile
    into 'libs'
}

apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
apply plugin: 'com.google.gms.google-services'

// запуск приложения

warn The following packages use deprecated "rnpm" config that will stop working from next release:
  - native-base: https://github.com/GeekyAnts/NativeBase#readme
  - react-native-google-signin: https://github.com/react-native-community/react-native-google-signin
Please notify their maintainers about it. You can find more details at https://github.com/react-native-community/cli/blob/master/docs/configuration.md#migration-guide.
info Starting JS server...
info Installing the app...

> Configure project :app
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)

> Task :app:processDebugGoogleServices
Parsing json file: ...\projectPath\android\app\google-services.json

> Task :app:installDebug
11:46:22 V/ddms: execute: running am get-config
11:46:22 V/ddms: execute 'am get-config' on '192.168.240.103:5555' : EOF hit. Read: -1
11:46:22 V/ddms: execute: returning
Installing APK 'app-debug.apk' on 'Google Nexus 5 - 5.0' for app:debug
11:46:22 D/app-debug.apk: Uploading app-debug.apk onto device '192.168.240.103:5555'
11:46:22 D/Device: Uploading file onto device '192.168.240.103:5555'
11:46:22 D/ddms: Reading file permision of ...\projectPath\android\app\build\outputs\apk\debug\app-debug.apk as: rwx------
11:46:22 V/ddms: execute: running pm install -r -t "/data/local/tmp/app-debug.apk"
11:46:26 V/ddms: execute 'pm install -r -t "/data/local/tmp/app-debug.apk"' on '192.168.240.103:5555' : EOF hit. Read: -1
11:46:26 V/ddms: execute: returning
11:46:26 V/ddms: execute: running rm "/data/local/tmp/app-debug.apk"
11:46:26 V/ddms: execute 'rm "/data/local/tmp/app-debug.apk"' on '192.168.240.103:5555' : EOF hit. Read: -1
11:46:26 V/ddms: execute: returning
Installed on 1 device.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 13s
65 actionable tasks: 3 executed, 62 up-to-date
'adb' is not recognized as an internal or external command,
operable program or batch file.
info Connecting to the development server...
warn Failed to connect to development server using "adb reverse": spawnSync adb ENOENT
info Starting the app...

1 Ответ

0 голосов
/ 14 июля 2019

Похоже, что в отличие от большинства учебных пособий для рН 0.60, используемый SHA должен быть из папки android / app

keytool -list -v -alias androiddebugkey -keystore projectname\android\app\debug.keystore

...