Skip to content
Advertisement

Firebase authentication works only on debug version

I have an app on google play: https://play.google.com/store/apps/details?id=com.conta.ftof and I have a big problem. I can’t get firebase authentication with phone number to work on the signed version. in fact, it works only with the debug version (when in the release version I insert the number and click the send button, the toast is returned: unknown error) … Precisely for this reason I can’t show the logcats, just because the error alone in the relase version … Can you help me please? I leave you the code:

Important lines of registrationactivity

@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);


            }

**RegistrationActivity:**https://codeshare.io/5wBAzp

Build Gradle :app

    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'

}

Build Gradle

    // 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
}

errori nei logcat nel DEBUG

        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

Advertisement

Answer

in my case, having similar problem, the solution proposed here solved my issue:

https://stackoverflow.com/a/50868434/559144

I was trying to grab the SHA1 signature from the keytool command against my app bundle compiled in release mode, but that did not work, what fixed the issue was to grab that signature from the google play console, under app signing settings, then paste it into Firebase console, without removing the debug signature, then grab latest google json file, put it in Android Studio, rebuild signed bundle, upload, release, and now all works great.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement