android Firebase身份验证仅适用于调试版本

cidc1ykv  于 2022-11-03  发布在  Android
关注(0)|答案(1)|浏览(217)

我在Google Play上有一个应用程序:https://play.google.com/store/apps/details?id=com.conta.ftof和我有一个大问题。我不能让firebase认证与电话号码工作在签署的版本。事实上,它只工作在调试版本(当在发布版本我插入号码,并点击发送按钮,吐司被返回:未知错误)...正是因为这个原因,我不能显示logcats,只是因为错误单独在发布版本...你能帮助我吗?我离开你的代码:

注册活动的重要线路

@Override
            public void onVerificationFailed(FirebaseException e) {

                if (e instanceof FirebaseAuthInvalidCredentialsException) {
                    Toast.makeText(RegistrationActivity.this, "Numero inserito non valido...", Toast.LENGTH_SHORT).show();
                }
                else if (e instanceof FirebaseTooManyRequestsException) {
                    Toast.makeText(RegistrationActivity.this, "Troppe richieste per questo numero di telefono, riprova tra 24h", Toast.LENGTH_SHORT).show();
                }

                else if (e instanceof FirebaseNetworkException){
                    Toast.makeText(RegistrationActivity.this, "Errore di rete...", Toast.LENGTH_SHORT).show();
                }

                else {

                    Toast.makeText(RegistrationActivity.this, "Errore sconosciuto", Toast.LENGTH_SHORT).show();
                }

                Log.e(TAG,  "err : " + e);
                loadingBar.dismiss();

               // Toast.makeText(RegistrationActivity.this, "Numero inserito non valido...", Toast.LENGTH_SHORT).show();
                relativeLayout.setVisibility(View.VISIBLE);

                continueAndNextBtn.setText("Continue"); //Continue
                codeText.setVisibility(View.GONE);

            }

注册活动:https://codeshare.io/5wBAzp
构建Gradle:应用程序

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.3"
    lintOptions {
        checkReleaseBuilds false
        // Or, if you prefer, you can continue to check for errors in release builds,
        // but continue the build even when errors are found:
        abortOnError false
    }

    defaultConfig {
        applicationId "com.conta.ftof"
        minSdkVersion 21
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'

        }
    }
}

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.google.firebase:firebase-auth:19.3.1'
    implementation 'com.google.firebase:firebase-database:19.3.0'
    implementation 'com.google.firebase:firebase-core:17.4.3'
    implementation 'com.firebaseui:firebase-ui-database:3.2.2'
    implementation 'com.hbb20:ccp:2.1.9'
    implementation 'pub.devrel:easypermissions:0.4.0'
    implementation 'com.android.support:percent:29.0.0'
    implementation 'com.google.android.gms:play-services-ads:19.4.0'

    implementation 'com.google.firebase:firebase-storage:19.1.1'
    implementation 'com.google.android.material:material:1.1.0'
    implementation 'androidx.navigation:navigation-fragment:2.2.2'
    implementation 'androidx.navigation:navigation-ui:2.2.2'
    implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
    implementation 'com.opentok.android:opentok-android-sdk:2.15.3'
    implementation 'pub.devrel:easypermissions:0.4.0'
    implementation 'com.squareup.picasso:picasso:2.71828'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    implementation 'com.google.firebase:firebase-analytics:17.4.3'

}

建立等级

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:4.0.0"
        classpath 'com.google.gms:google-services:4.3.3'

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

allprojects {
    repositories {
        google()
        jcenter()

        maven { url 'https://maven.google.com'}
        maven { url 'https://tokbox.bintray.com/maven'}
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

调试时不记录错误

2020-10-14 21:46:16.629 12564-12564/com.conta.ftof E/RegistrationActivity: err : com.google.firebase.FirebaseException: An internal error has occurred. [ Error code:39 ]

        2020-10-14 21:46:16.697 2026-4029/? E/Auth: [GoogleAccountDataServiceImpl] getToken() -> BAD_AUTHENTICATION. Account: <ELLIDED:718006122>, App: com.google.android.gms, Service: oauth2:https://www.googleapis.com/auth/emeraldsea.mobileapps.doritos.cookie
        rlv: Long live credential not available.
            at gbq.a(:com.google.android.gms@202614030@20.26.14 (100408-320008519):17)
            at gac.a(:com.google.android.gms@202614030@20.26.14 (100408-320008519):118)
            at cqx.a(:com.google.android.gms@202614030@20.26.14 (100408-320008519):235)
            at cqx.a(:com.google.android.gms@202614030@20.26.14 (100408-320008519):108)
            at cqx.a(:com.google.android.gms@202614030@20.26.14 (100408-320008519):240)
            at cox.onTransact(:com.google.android.gms@202614030@20.26.14 (100408-320008519):5)
            at android.os.Binder.transact(Binder.java:675)
            at csu.onTransact(:com.google.android.gms@202614030@20.26.14 (100408-320008519):2)
            at android.os.Binder.transact(Binder.java:675)
            at zyq.onTransact(:com.google.android.gms@202614030@20.26.14 (100408-320008519):17)
            at android.os.Binder.execTransact(Binder.java:739)

            2020-10-14 21:46:16.718 612-832/? E/BufferQueueProducer: [] mConsumerName == NULL!!!!!!
    2020-10-14 21:46:16.577 688-1286/? E/dubaid: [DubaiUtils.h] parseMessage# Failed to find second tag: uid=
    2020-10-14 21:46:16.577 688-1286/? E/dubaid: [SystemHandler.cpp] parsePartialWakelockAcquiredMessage# Failed to parse count: lock=220525660 tag=*gms_scheduler*:internal count=0
    2020-10-14 21:46:16.577 688-1286/? E/dubaid: [SystemHandler.cpp] onPartialWakelockAcquireMessage# Failed to parse message
    2020-10-14 21:46:16.580 2664-7832/? E/Volley: [420] BasicNetwork.performRequest: Unexpected response code 503 for https://www.googleapis.com/identitytoolkit/v3/relyingparty/sendVerificationCode?alt=proto&key=AIzaSyA3J5SF6W94IhtZ_dQ6UOVqUhIN133zrhU

2020-10-14 21:46:15.834 1272-3654/? E/WifiService: enforceCanAccessScanResults: hiding ssid and bssidLocation mode is disabled for the device
wn9m85ua

wn9m85ua1#

在我的情况下,有类似的问题,这里提出的解决方案解决了我的问题:
https://stackoverflow.com/a/50868434/559144
我试图从keytool命令中获取SHA1签名,但没有成功,解决问题的方法是从Google Play控制台的应用签名设置中获取该签名,然后将其粘贴到Firebase控制台中,而不删除调试签名,然后获取最新的google json文件,将其放入Android Studio中,重建签名包,上传,发布,现在一切都很好。

相关问题