androidfirebasegoogle-authentication

Error 16 problem with sign in google firebase account


As you can see, here is my code mostly copied from google documentation for google sign in authentication. The problem is when I click on sign in button it throws me an error called "16:" Sorry for posting images, I got problem with posting a code, hope so someone can help me to solve this problem.

**Dependencies //for firebase

    implementation 'com.google.firebase:firebase-messaging:15.0.2'
    implementation 'com.google.firebase:firebase-database:16.0.1'
    implementation 'com.google.firebase:firebase-crash:15.0.2'
    implementation 'com.firebase:firebase-client-android:2.3.1'
    implementation 'com.google.firebase:firebase-storage:15.0.2'
    implementation 'com.firebaseui:firebase-ui-auth:3.3.1'
    implementation 'com.google.firebase:firebase-auth:16.0.3'
    implementation 'com.google.android.gms:play-services-auth:16.0.0'**

    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_welcome_screen);
    onCreate();
    SignInButton signInButton = findViewById(R.id.sign_in_button);
    signInButton.setSize(SignInButton.SIZE_STANDARD);
    GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
            .requestEmail()
            .build();
    mGoogleSignInClient = GoogleSignIn.getClient(this, gso);
    mAuth = FirebaseAuth.getInstance();
    signInButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            signIn();
        }
    });
}

private void signIn() {
    Intent signInIntent = mGoogleSignInClient.getSignInIntent();
    startActivityForResult(signInIntent, RC_SIGN_IN);
}

private void handleSignInResult(Task<GoogleSignInAccount> completedTask) {
    try {
        GoogleSignInAccount account = completedTask.getResult(ApiException.class);
        Intent intent = new Intent(WelcomeScreen.this, Main.class);
        startActivity(intent);
    } catch (ApiException e) {
        Toast.makeText(WelcomeScreen.this, "problem je: " + e.getStatusCode(), Toast.LENGTH_SHORT).show();
    }
}

@Override
public void onStart() {
    super.onStart();
    if (mAuth.getCurrentUser() != null) {
        Intent intent = new Intent(WelcomeScreen.this, Main.class);
        startActivity(intent);
    }
}

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == RC_SIGN_IN) {
        Task<GoogleSignInAccount> task = GoogleSignIn.getSignedInAccountFromIntent(data);
        handleSignInResult(task);
    }
}

Stack trace:

 2018-09-27 16:32:54.320 6371-6371/com.example.user.graduationproject I/art: Late-enabling -Xcheck:jni
2018-09-27 16:32:54.320 6371-6371/com.example.user.graduationproject D/houdini: [6371] Initialize library(version: 6.1.2d_x.48748 RELEASE)... successfully.
2018-09-27 16:32:54.512 6371-6387/com.example.user.graduationproject W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
2018-09-27 16:32:54.540 6371-6391/com.example.user.graduationproject I/DynamiteModule: Considering local module com.google.android.gms.flags:2 and remote module com.google.android.gms.flags:3
2018-09-27 16:32:54.540 6371-6391/com.example.user.graduationproject I/DynamiteModule: Selected remote version of com.google.android.gms.flags, version >= 3
2018-09-27 16:32:54.545 6371-6385/com.example.user.graduationproject D/libEGL: loaded /system/lib/egl/libEGL_adreno.so
2018-09-27 16:32:54.549 6371-6371/com.example.user.graduationproject V/FA: Registered activity lifecycle callback
2018-09-27 16:32:54.550 6371-6391/com.example.user.graduationproject W/System: ClassLoader referenced unknown path: 
2018-09-27 16:32:54.558 6371-6391/com.example.user.graduationproject D/ApplicationLoaders: ignored Vulkan layer search path /data/app/com.google.android.gms-1/lib/x86:/data/app/com.google.android.gms-1/base.apk!/lib/x86 for namespace 0xb7684090
2018-09-27 16:32:54.560 6371-6371/com.example.user.graduationproject I/FirebaseInitProvider: FirebaseApp initialization successful
2018-09-27 16:32:54.562 6371-6371/com.example.user.graduationproject I/InstantRun: starting instant run server: is main process
2018-09-27 16:32:54.573 6371-6392/com.example.user.graduationproject W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
2018-09-27 16:32:54.575 6371-6385/com.example.user.graduationproject D/libEGL: loaded /system/lib/egl/libGLESv1_CM_adreno.so
2018-09-27 16:32:54.581 6371-6385/com.example.user.graduationproject D/libEGL: loaded /system/lib/egl/libGLESv2_adreno.so
2018-09-27 16:32:54.595 6371-6371/com.example.user.graduationproject W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
2018-09-27 16:32:54.598 6371-6371/com.example.user.graduationproject V/FA: onActivityCreated
2018-09-27 16:32:54.607 6371-6391/com.example.user.graduationproject W/System: ClassLoader referenced unknown path: /data/user_de/0/com.google.android.gms/app_chimera/m/0000000a/n/armeabi-v7a
2018-09-27 16:32:54.607 6371-6391/com.example.user.graduationproject W/System: ClassLoader referenced unknown path: /data/user_de/0/com.google.android.gms/app_chimera/m/0000000a/n/armeabi
2018-09-27 16:32:54.609 6371-6392/com.example.user.graduationproject I/FirebaseAuth: [FirebaseAuth:] Loading module via FirebaseOptions.
2018-09-27 16:32:54.609 6371-6392/com.example.user.graduationproject I/FirebaseAuth: [FirebaseAuth:] Preparing to create service connection to gms implementation
2018-09-27 16:32:54.632 6371-6395/com.example.user.graduationproject V/FA: Collection enabled
2018-09-27 16:32:54.632 6371-6395/com.example.user.graduationproject V/FA: App package, google app id: com.example.user.graduationproject, 1:155824206953:android:24d999f6e00c6563
2018-09-27 16:32:54.632 6371-6395/com.example.user.graduationproject I/FA: App measurement is starting up, version: 12451
2018-09-27 16:32:54.632 6371-6395/com.example.user.graduationproject I/FA: To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
2018-09-27 16:32:54.632 6371-6395/com.example.user.graduationproject I/FA: To enable faster debug mode event logging run:
      adb shell setprop debug.firebase.analytics.app com.example.user.graduationproject
2018-09-27 16:32:54.632 6371-6395/com.example.user.graduationproject D/FA: Debug-level message logging enabled
2018-09-27 16:32:54.635 6371-6391/com.example.user.graduationproject W/DynamiteModule: Local module descriptor class for com.google.android.gms.crash not found.
2018-09-27 16:32:54.637 6371-6391/com.example.user.graduationproject I/DynamiteModule: Considering local module com.google.android.gms.crash:0 and remote module com.google.android.gms.crash:215
2018-09-27 16:32:54.637 6371-6391/com.example.user.graduationproject I/DynamiteModule: Selected remote version of com.google.android.gms.crash, version >= 215
2018-09-27 16:32:54.640 6371-6391/com.example.user.graduationproject I/FirebaseCrashApiImpl: FirebaseCrashApiImpl created by ClassLoader ad[DexPathList[[zip file "/data/user_de/0/com.google.android.gms/app_chimera/m/0000000a/DynamiteModulesC.apk"],nativeLibraryDirectories=[/data/user_de/0/com.google.android.gms/app_chimera/m/0000000a/n/armeabi-v7a, /data/user_de/0/com.google.android.gms/app_chimera/m/0000000a/n/armeabi, /system/lib, /vendor/lib]]]
2018-09-27 16:32:54.641 6371-6391/com.example.user.graduationproject I/FirebaseCrash: FirebaseCrash reporting loaded - com.google.android.gms.internal.measurement.zzxw@9bbbe64
2018-09-27 16:32:54.648 6371-6393/com.example.user.graduationproject I/DynamiteModule: Considering local module com.google.android.gms.flags:2 and remote module com.google.android.gms.flags:3
2018-09-27 16:32:54.648 6371-6393/com.example.user.graduationproject I/DynamiteModule: Selected remote version of com.google.android.gms.flags, version >= 3
2018-09-27 16:32:54.652 6371-6393/com.example.user.graduationproject W/DynamiteModule: Local module descriptor class for com.google.android.gms.crash not found.
2018-09-27 16:32:54.662 6371-6393/com.example.user.graduationproject I/FirebaseCrashApiImpl: FirebaseCrash reporting API initialized
2018-09-27 16:32:54.662 6371-6393/com.example.user.graduationproject I/FirebaseCrash: FirebaseCrash reporting initialized com.google.android.gms.internal.measurement.zzxw@9bbbe64
2018-09-27 16:32:54.662 6371-6393/com.example.user.graduationproject D/FirebaseCrash: Firebase Analytics Listener for Firebase Crash is initialized
2018-09-27 16:32:54.666 6371-6395/com.example.user.graduationproject V/FA: Cancelling job. JobID: -1494669227
2018-09-27 16:32:54.676 6371-6395/com.example.user.graduationproject V/FA: Connecting to remote service
2018-09-27 16:32:54.680 6371-6395/com.example.user.graduationproject V/FA: Connection attempt already in progress
2018-09-27 16:32:55.250 6371-6371/com.example.user.graduationproject D/ApplicationLoaders: ignored Vulkan layer search path /data/app/com.google.android.gms-1/lib/x86:/data/app/com.google.android.gms-1/base.apk!/lib/x86 for namespace 0xb76840d0
2018-09-27 16:32:55.256 6371-6371/com.example.user.graduationproject I/DynamiteModule: Considering local module com.google.android.gms.signinbutton_dynamite:0 and remote module com.google.android.gms.signinbutton_dynamite:2
2018-09-27 16:32:55.256 6371-6371/com.example.user.graduationproject I/DynamiteModule: Selected remote version of com.google.android.gms.signinbutton_dynamite, version >= 2
2018-09-27 16:32:55.274 6371-6371/com.example.user.graduationproject W/System: ClassLoader referenced unknown path: /data/user_de/0/com.google.android.gms/app_chimera/m/00000009/n/armeabi-v7a
2018-09-27 16:32:55.274 6371-6371/com.example.user.graduationproject W/System: ClassLoader referenced unknown path: /data/user_de/0/com.google.android.gms/app_chimera/m/00000009/n/armeabi
2018-09-27 16:32:55.323 6371-6395/com.example.user.graduationproject I/FA: Tag Manager is not found and thus will not be used
2018-09-27 16:32:55.335 6371-6395/com.example.user.graduationproject D/FA: Logging event (FE): screen_view(_vs), Bundle[{firebase_event_origin(_o)=auto, firebase_screen_class(_sc)=WelcomeScreen, firebase_screen_id(_si)=-4609609622484588595}]
2018-09-27 16:32:55.350 6371-6395/com.example.user.graduationproject V/FA: Connection attempt already in progress
2018-09-27 16:32:55.351 6371-6395/com.example.user.graduationproject V/FA: Connection attempt already in progress
2018-09-27 16:32:55.351 6371-6395/com.example.user.graduationproject V/FA: Activity resumed, time: 2956494
2018-09-27 16:32:55.363 6371-6399/com.example.user.graduationproject I/OpenGLRenderer: Initialized EGL, version 1.4
2018-09-27 16:32:55.363 6371-6399/com.example.user.graduationproject D/OpenGLRenderer: Swap behavior 1
2018-09-27 16:32:55.413 6371-6399/com.example.user.graduationproject W/EGL_emulation: eglSurfaceAttrib not implemented 3093 12436
2018-09-27 16:32:55.413 6371-6399/com.example.user.graduationproject W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xa9078e80, error=EGL_SUCCESS
2018-09-27 16:32:55.420 6371-6371/com.example.user.graduationproject W/art: Before Android 4.1, method int android.support.v7.widget.DropDownListView.lookForSelectablePosition(int, boolean) would have incorrectly overridden the package-private method in android.widget.ListView
2018-09-27 16:32:55.460 6371-6395/com.example.user.graduationproject D/FA: Connected to remote service
2018-09-27 16:32:55.461 6371-6395/com.example.user.graduationproject V/FA: Processing queued up service tasks: 4
2018-09-27 16:32:57.221 6371-6395/com.example.user.graduationproject V/FA: Recording user engagement, ms: 1898
2018-09-27 16:32:57.222 6371-6395/com.example.user.graduationproject V/FA: Activity paused, time: 2958392
2018-09-27 16:32:57.224 6371-6395/com.example.user.graduationproject D/FA: Logging event (FE): user_engagement(_e), Bundle[{firebase_event_origin(_o)=auto, engagement_time_msec(_et)=1898, firebase_screen_class(_sc)=WelcomeScreen, firebase_screen_id(_si)=-4609609622484588595}]
2018-09-27 16:32:57.231 6371-6371/com.example.user.graduationproject V/FA: onActivityCreated
2018-09-27 16:32:57.241 6371-6395/com.example.user.graduationproject D/FA: Logging event (FE): screen_view(_vs), Bundle[{firebase_event_origin(_o)=auto, firebase_previous_class(_pc)=WelcomeScreen, firebase_previous_id(_pi)=-4609609622484588595, firebase_screen_class(_sc)=SignInHubActivity, firebase_screen_id(_si)=-4609609622484588594}]
2018-09-27 16:32:57.268 6371-6395/com.example.user.graduationproject V/FA: Activity resumed, time: 2958410
2018-09-27 16:32:57.269 6371-6395/com.example.user.graduationproject V/FA: Screen exposed for less than 1000 ms. Event not sent. time: 31
2018-09-27 16:32:57.273 6371-6395/com.example.user.graduationproject V/FA: Activity paused, time: 2958411
2018-09-27 16:32:57.287 6371-6399/com.example.user.graduationproject W/EGL_emulation: eglSurfaceAttrib not implemented 3093 12436
2018-09-27 16:32:57.287 6371-6399/com.example.user.graduationproject W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xb2d390c0, error=EGL_SUCCESS
2018-09-27 16:33:01.904 6371-6371/com.example.user.graduationproject W/System.err: com.google.android.gms.common.api.ApiException: 16: 
2018-09-27 16:33:01.904 6371-6371/com.example.user.graduationproject W/System.err:     at com.google.android.gms.common.internal.ApiExceptionUtil.fromStatus(Unknown Source)
2018-09-27 16:33:01.904 6371-6371/com.example.user.graduationproject W/System.err:     at com.google.android.gms.auth.api.signin.GoogleSignIn.getSignedInAccountFromIntent(Unknown Source)
2018-09-27 16:33:01.904 6371-6371/com.example.user.graduationproject W/System.err:     at com.example.user.graduationproject.Bjelasnica.WelcomeScreen.onActivityResult(WelcomeScreen.java:88)
2018-09-27 16:33:01.904 6371-6371/com.example.user.graduationproject W/System.err:     at android.app.Activity.dispatchActivityResult(Activity.java:6945)
2018-09-27 16:33:01.904 6371-6371/com.example.user.graduationproject W/System.err:     at android.app.ActivityThread.deliverResults(ActivityThread.java:4088)
2018-09-27 16:33:01.904 6371-6371/com.example.user.graduationproject W/System.err:     at android.app.ActivityThread.handleSendResult(ActivityThread.java:4135)
2018-09-27 16:33:01.904 6371-6371/com.example.user.graduationproject W/System.err:     at android.app.ActivityThread.-wrap20(ActivityThread.java)
2018-09-27 16:33:01.904 6371-6371/com.example.user.graduationproject W/System.err:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1536)
2018-09-27 16:33:01.904 6371-6371/com.example.user.graduationproject W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:102)
2018-09-27 16:33:01.904 6371-6371/com.example.user.graduationproject W/System.err:     at android.os.Looper.loop(Looper.java:154)
2018-09-27 16:33:01.904 6371-6371/com.example.user.graduationproject W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:6169)
2018-09-27 16:33:01.904 6371-6371/com.example.user.graduationproject W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
2018-09-27 16:33:01.904 6371-6371/com.example.user.graduationproject W/System.err:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:891)
2018-09-27 16:33:01.904 6371-6371/com.example.user.graduationproject W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:781)
2018-09-27 16:33:01.910 6371-6395/com.example.user.graduationproject D/FA: Logging event (FE): screen_view(_vs), Bundle[{firebase_event_origin(_o)=auto, firebase_previous_class(_pc)=SignInHubActivity, firebase_previous_id(_pi)=-4609609622484588594, firebase_screen_class(_sc)=WelcomeScreen, firebase_screen_id(_si)=-4609609622484588595}]
2018-09-27 16:33:01.936 6371-6395/com.example.user.graduationproject V/FA: Activity resumed, time: 2963077
2018-09-27 16:33:01.953 6371-6399/com.example.user.graduationproject W/EGL_emulation: eglSurfaceAttrib not implemented 3093 12436
2018-09-27 16:33:01.953 6371-6399/com.example.user.graduationproject W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xb2d390c0, error=EGL_SUCCESS
2018-09-27 16:33:04.784 6371-6426/com.example.user.graduationproject I/FirebaseCrash: Sending crashes
2018-09-27 16:33:06.937 6371-6395/com.example.user.graduationproject V/FA: Inactivity, disconnecting from the service

Solution

  • I had the same problem. This is my solution. I hope you will understand.

    Situation: How to solve this problem when there is an error code '16:', stuck at the 'Sign In with Google', after we pressed our email at the messagebox not next activity appear but only appear the error.

    5.2. To solve this:

    5.2.1. Get SHA1 from your project (Android Studio)

    5.2.2. Create the API Key and OAuth 2.0 client IDs (Android type). (https://console.cloud.google.com/apis/credentials)

    5.2.3. So, the data is set at Google, so get the new Firebase Console google.json at https://console.firebase.google.com/ (at Project Settings). Download it then replace.

    5.2.4. Close the Android Studio, open back, then 'Make Project'

    5.2.5. Run at the phone. Success!

    Refer to this link: google signIn not working in release mode apk android

    Extra about google api: https://developers.google.com/maps/documentation/android-sdk/config (adding extra things for the manifest.xml)