Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onActivityResult not fired! #182

Closed
Fax3D opened this issue Jun 9, 2016 · 39 comments · Fixed by #357
Closed

onActivityResult not fired! #182

Fax3D opened this issue Jun 9, 2016 · 39 comments · Fixed by #357

Comments

@Fax3D
Copy link

Fax3D commented Jun 9, 2016

I'm using the new version 0.4.1 of the auth library (on a device with Android 6.0.1).

I'm trying to use the Google sign in provider, launching this intent:

startActivityForResult(
                AuthUI.getInstance()
                        .createSignInIntentBuilder()
                        .setProviders(
                                AuthUI.EMAIL_PROVIDER,
                                AuthUI.GOOGLE_PROVIDER)
                        .build(),
                RC_SIGN_IN);

When i login with email&password everythings works fine, but when i try to login with the google sign in button, i select the account and i can see a loader for about 3-4 seconds: then the loader disappears and nothing else happens, i still remain into the activity with the two login buttons.
onActivityResult isn't fired and i don't know if login was successful or not.

Thanks.

@sv
Copy link

sv commented Jun 10, 2016

Just update to 0.4.1 - same issue. Cancel result fires on a back button.

@omarmiatello
Copy link

Same issue, but it was my fault. Check in your build.gradle this dependencies
compile 'com.google.firebase:firebase-auth:9.0.2'

NOTE: Developers need a warning if missing!

@sv
Copy link

sv commented Jun 13, 2016

i have compile 'com.google.firebase:firebase-auth:9.0.2' in build.gradle, but still have this issue

@samtstern
Copy link
Contributor

@Fax3D have you added your SHA1 and package name in the Firebase console and downloaded the google-services.json file in the right place? Google Sign In (GSI) requires SHA1/package match but email and password does not, so this failure implies there is something wrong with your GSI configuration.

@Fax3D
Copy link
Author

Fax3D commented Jun 15, 2016

Hi @samtstern, yes i've added my SHA1 and i've downloaded the google-services.json in the right place. In the older version 0.4.0 was right, only with the new 0.4.1 i see this issue.
And, i have compile 'com.google.firebase:firebase-auth:9.0.2' in build.gradle

Thanks

@sipersso
Copy link

I had this problem too! Turned out it was caused by not having internet connectivity on the device. The email auth provider would then throw an internal error and the activity would not finish.

@dazza5000
Copy link

I'm having this issue. Anyone find a good work around?

@amandle
Copy link
Contributor

amandle commented Jun 30, 2016

@Fax3D do you see anything in the logs like "Firebase sign in with credential unsuccessful" or any mention of error code 12501?

@tehras
Copy link

tehras commented Jul 6, 2016

I'm actually having the same issue, using 9.0.2 with 0.4.1. I can login fine with email, but not Google . I do not get anything back in the onActivityResult

@NicholasSTG
Copy link

I'm having the same issue as @tehras

@samtstern
Copy link
Contributor

@tehras @NicholasSTG did you enable Google Auth in the 'providers' tab of the Firebase Console? Did you enter the correct SHA1 and package name?

@NicholasSTG
Copy link

I did on both accounts. I also just double checked the console and my google-services.json account to make sure.

@tehras
Copy link

tehras commented Jul 6, 2016

@nichola I was missing the Google play services auth library

@NicholasSTG
Copy link

@tehras it seems that was my issue as well; once I did that and updated a few other libraries (and rebuilt the heck out of the project) it seems to be working.

@samtstern
Copy link
Contributor

Looks like @tehras and @NicholasSTG have solved their issue. @Fax3D is the issue persisting for you? If not we can close this issue.

@Fax3D
Copy link
Author

Fax3D commented Jul 7, 2016

Hi @samtstern, i've just checked my configuration like proposed by @tehras and @NicholasSTG and seems to be ok, it's all up to date and i've already play services auth library... and the issue still persist!
Tomorrow i'll paste here my logcat trace to help you find this issue.

Thanks!

@Fax3D
Copy link
Author

Fax3D commented Jul 8, 2016

Hi @samtstern,

looking into logs, i found this exception:

Class not found when unmarshalling: com.google.android.gms.auth.api.signin.internal.SignInConfiguration
                                        java.lang.ClassNotFoundException: com.google.android.gms.auth.api.signin.internal.SignInConfiguration
                                            at java.lang.Class.classForName(Native Method)
                                            at java.lang.Class.forName(Class.java:308)
                                            at java.lang.Class.forName(Class.java:272)
                                            at android.os.Parcel.readParcelableCreator(Parcel.java:2275)
                                            at android.os.Parcel.readParcelable(Parcel.java:2239)
                                            at android.os.Parcel.readValue(Parcel.java:2146)
                                            at android.os.Parcel.readArrayMapInternal(Parcel.java:2479)
                                            at android.os.BaseBundle.unparcel(BaseBundle.java:221)
                                            at android.os.BaseBundle.getString(BaseBundle.java:918)
                                            at android.content.Intent.getStringExtra(Intent.java:5386)
                                            at com.android.server.am.ActivityStackSupervisor.startActivityLocked(ActivityStackSupervisor.java:1780)
                                            at com.android.server.am.ActivityStackSupervisor.startActivityMayWait(ActivityStackSupervisor.java:1334)
                                            at com.android.server.am.ActivityManagerService.startActivityAsUser(ActivityManagerService.java:4802)
                                            at com.android.server.am.ActivityManagerService.startActivity(ActivityManagerService.java:4639)
                                            at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:142)
                                            at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3139)
                                            at android.os.Binder.execTransact(Binder.java:446)
                                         Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.auth.api.signin.internal.SignInConfiguration" on path: DexPathList[[directory "."],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
                                            at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
                                            at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
                                            at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
                                            at java.lang.Class.classForName(Native Method) 
                                            at java.lang.Class.forName(Class.java:308) 
                                            at java.lang.Class.forName(Class.java:272) 
                                            at android.os.Parcel.readParcelableCreator(Parcel.java:2275) 
                                            at android.os.Parcel.readParcelable(Parcel.java:2239) 
                                            at android.os.Parcel.readValue(Parcel.java:2146) 
                                            at android.os.Parcel.readArrayMapInternal(Parcel.java:2479) 
                                            at android.os.BaseBundle.unparcel(BaseBundle.java:221) 
                                            at android.os.BaseBundle.getString(BaseBundle.java:918) 
                                            at android.content.Intent.getStringExtra(Intent.java:5386) 
                                            at com.android.server.am.ActivityStackSupervisor.startActivityLocked(ActivityStackSupervisor.java:1780) 
                                            at com.android.server.am.ActivityStackSupervisor.startActivityMayWait(ActivityStackSupervisor.java:1334) 
                                            at com.android.server.am.ActivityManagerService.startActivityAsUser(ActivityManagerService.java:4802) 
                                            at com.android.server.am.ActivityManagerService.startActivity(ActivityManagerService.java:4639) 
                                            at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:142) 
                                            at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3139) 
                                            at android.os.Binder.execTransact(Binder.java:446) 
                                            Suppressed: java.lang.ClassNotFoundException: com.google.android.gms.auth.api.signin.internal.SignInConfiguration
                                            at java.lang.Class.classForName(Native Method)
                                            at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
                                            at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
                                            at java.lang.ClassLoader.loadClass(ClassLoader.java:504)

@alexisvapillon
Copy link

I see the same issue, but on a Samsung S6 only (G920F / Android 6.0.1).
My app works just fine on several other devices (3x Nexuses, 2x Sony).

The google registration works OK but the onActivityResult() callback is never fired.

That's a major issue since my app is doing some mandatory initializations in this callback...

@sipersso
Copy link

sipersso commented Jul 20, 2016

In my case, I just had not added the correct SHA key to the Google Services json and it works now. Would be nice to get an error message though....

@Fax3D
Copy link
Author

Fax3D commented Jul 25, 2016

This issue still persist in version 0.4.3... anyone?

Thanks.

@aterbo
Copy link

aterbo commented Aug 2, 2016

I was chasing down a similar bug for a long time, but it was an issue with my activity lifecycle.

I had some code in my onStart() method which checked if a user was logged in, and if so moved to another activity. This was bypassing the onActivityResult() method.

Moving my log in check into the onResume() method allowed onActivityResult() to be fired properly.

FYI, I was following this guidance, which does not specify what part of the Activity lifecycle is best to check the log in status. It was my fault that I didn't know whe onActivityResult() is called!
https://firebase.google.com/docs/auth/android/manage-users#get_the_currently_signed-in_user

@alfongj alfongj added the auth label Aug 2, 2016
@kumarkeviv
Copy link

Hi

I am using Firebase UI 0.4.4 and Play Services 9.4.0

//Google Play Services
compile 'com.google.android.gms:play-services:9.4.0'
//Firebase UI
compile 'com.firebaseui:firebase-ui:0.4.4'

onActivityResult is not being fired, Facebook and Email auth is working fine.
But when I tap on Google Login after asking email-id it just goes away and don't fire onActivityresult.

I have added SHA-1 key and also enabled google login in firebase console, plus google json config file is updated and at right place.

Please any can help?

@kumarkeviv
Copy link

Here is the log's but I am unable to get a hint of whats happening...

08-04 11:17:36.738 23903-23903/com.phoenixapplabs.learnpython E/Typeface: SANS_LOC file not found.
08-04 11:17:37.228 23903-23903/com.phoenixapplabs.learnpython D/FindExtension: FindExtension: before mHardwareRenderer.initialize, mSurface.isValid() = true
08-04 11:17:37.248 23903-23903/com.phoenixapplabs.learnpython D/FindExtension: FindExtension: before mHardwareRenderer.initialize, mSurface.isValid() = true
08-04 11:17:37.949 23903-23903/com.phoenixapplabs.learnpython 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
08-04 11:17:37.959 23903-23903/com.phoenixapplabs.learnpython E/Typeface: SANS_LOC file not found.
08-04 11:17:38.109 23903-23903/com.phoenixapplabs.learnpython D/AutoManageHelper: starting AutoManage for client 1 false false
08-04 11:17:38.149 23903-23903/com.phoenixapplabs.learnpython D/AutoManageHelper: onStart true {1=com.google.android.gms.internal.zzpk$zza@380a7ac6}
08-04 11:17:38.209 23903-23903/com.phoenixapplabs.learnpython D/FindExtension: FindExtension: before mHardwareRenderer.initialize, mSurface.isValid() = true
08-04 11:17:44.486 23903-23903/com.phoenixapplabs.learnpython D/FindExtension: FindExtension: before mHardwareRenderer.initialize, mSurface.isValid() = true
08-04 11:17:44.546 23903-23903/com.phoenixapplabs.learnpython E/Typeface: SANS_LOC file not found.
08-04 11:17:44.606 23903-23903/com.phoenixapplabs.learnpython D/FindExtension: FindExtension: before mHardwareRenderer.initialize, mSurface.isValid() = true
08-04 11:17:45.877 23903-23959/com.phoenixapplabs.learnpython I/DynamiteModule: Considering local module com.google.android.gms.tagmanager:3 and remote module com.google.android.gms.tagmanager:3
08-04 11:17:45.877 23903-23959/com.phoenixapplabs.learnpython I/DynamiteModule: Selected local version of com.google.android.gms.tagmanager
08-04 11:17:46.678 23903-23927/com.phoenixapplabs.learnpython W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
08-04 11:17:47.359 23903-23959/com.phoenixapplabs.learnpython W/GoogleTagManager: Tag Manager's event handler WILL NOT be installed (no container loaded)
08-04 11:17:47.359 23903-23959/com.phoenixapplabs.learnpython I/GoogleTagManager: Tag Manager initilization took 1402ms
08-04 11:17:51.333 24866-24866/com.phoenixapplabs.learnpython:background_crash W/ResourcesManager: Asset path '/system/framework/com.android.media.remotedisplay.jar' does not exist or contains no resources.
08-04 11:17:51.333 24866-24866/com.phoenixapplabs.learnpython:background_crash W/ResourcesManager: Asset path '/system/framework/com.android.location.provider.jar' does not exist or contains no resources.
08-04 11:17:51.303 24866-24866/com.phoenixapplabs.learnpython:background_crash I/MultiDex: VM with version 2.1.0 has multidex support
08-04 11:17:51.303 24866-24866/com.phoenixapplabs.learnpython:background_crash I/MultiDex: install
08-04 11:17:51.303 24866-24866/com.phoenixapplabs.learnpython:background_crash I/MultiDex: VM has multidex support, MultiDex support library is disabled.
08-04 11:17:51.303 24866-24866/com.phoenixapplabs.learnpython:background_crash E/Typeface: SANS_LOC file not found.
08-04 11:17:51.303 24866-24866/com.phoenixapplabs.learnpython:background_crash I/MultiDex: install
08-04 11:17:51.303 24866-24866/com.phoenixapplabs.learnpython:background_crash I/MultiDex: VM has multidex support, MultiDex support library is disabled.
08-04 11:17:51.313 24866-24866/com.phoenixapplabs.learnpython:background_crash W/DynamiteModule: Local module descriptor class for com.google.android.gms.crash not found.
08-04 11:17:51.373 24866-24866/com.phoenixapplabs.learnpython:background_crash D/ChimeraCfgMgr: Reading stored module config
08-04 11:17:51.393 24866-24866/com.phoenixapplabs.learnpython:background_crash I/DynamiteModule: Considering local module com.google.android.gms.crash:0 and remote module com.google.android.gms.crash:3
08-04 11:17:51.393 24866-24866/com.phoenixapplabs.learnpython:background_crash I/DynamiteModule: Selected remote version of com.google.android.gms.crash, version >= 3
08-04 11:17:51.413 24866-24866/com.phoenixapplabs.learnpython:background_crash D/ChimeraFileApk: Primary ABI of requesting process is armeabi-v7a
08-04 11:17:51.413 24866-24866/com.phoenixapplabs.learnpython:background_crash I/art: DexFile_isDexOptNeeded failed to open oat file '/data/dalvik-cache/arm/data@data@com.google.android.gms@app_chimera@m@0000000b@DynamiteModulesC_GmsCore_prodlmp_xxhdpi_release.apk@classes.dex' for file location '/data/data/com.google.android.gms/app_chimera/m/0000000b/DynamiteModulesC_GmsCore_prodlmp_xxhdpi_release.apk': Failed to open oat filename for reading: No such file or directory
08-04 11:17:51.443 24866-24866/com.phoenixapplabs.learnpython:background_crash D/ChimeraFileApk: Classloading successful. Optimized code found.
08-04 11:17:51.453 24866-24866/com.phoenixapplabs.learnpython:background_crash I/FirebaseCrashReceiverServiceImpl: FirebaseCrashReceiverServiceImpl created by ClassLoader com.google.android.chimera.container.internal.DelegateLastPathClassLoader[DexPathList[[zip file "/data/data/com.google.android.gms/app_chimera/m/0000000b/DynamiteModulesC_GmsCore_prodlmp_xxhdpi_release.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]]
08-04 11:17:51.463 24866-24866/com.phoenixapplabs.learnpython:background_crash D/FirebaseCrashReceiverServiceImpl: onCreate
08-04 11:17:51.483 24866-24866/com.phoenixapplabs.learnpython:background_crash I/DynamiteModule: Considering local module com.google.android.gms.flags:0 and remote module com.google.android.gms.flags:1
08-04 11:17:51.483 24866-24866/com.phoenixapplabs.learnpython:background_crash I/DynamiteModule: Selected remote version of com.google.android.gms.flags, version >= 1
08-04 11:17:51.523 24866-24866/com.phoenixapplabs.learnpython:background_crash I/FirebaseCrashSenderServiceImpl: FirebaseCrashSenderServiceImpl created by ClassLoader com.google.android.chimera.container.internal.DelegateLastPathClassLoader[DexPathList[[zip file "/data/data/com.google.android.gms/app_chimera/m/0000000b/DynamiteModulesC_GmsCore_prodlmp_xxhdpi_release.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]]
08-04 11:17:51.533 24866-24866/com.phoenixapplabs.learnpython:background_crash D/FirebaseCrashSenderServiceImpl: onCreate

@janakagamini
Copy link

janakagamini commented Aug 10, 2016

I was struggling with this for a while and I had a combination of factors (some may be irrelevant but I caught them when debugging this issue nevertheless):

  1. Forgotten to include internet permissions.
  2. Not including the play services library as pointed out by @tehras.
  3. apply plugin: 'com.google.gms.google-services' not being at the bottom of the build.gradle file (had it at the top instead). Read here.
  4. Wrong SHA1, I had initially created the project from a different computer so SHA1 for the debug key on that computer is different (obviously). Quick and easy way to get the SHA1.
  5. Package name wrong in google-services.json file. I had two android apps on the same Firebase project each with a different package name. Even though I downloaded the correct google-services.json file from the Project Settings page, the file being downloaded was always for the first app I created (probably a bug in the Firebase Console). I had to delete both my apps (not the project) and create a new app to get the correct file.

Hope this helps.

@fabriciointerama
Copy link

Any login method makes my app to close. No error msg is printed. It just closes.

@dcalano
Copy link

dcalano commented Aug 20, 2016

I am having the same reaction as fabriciointerama.

Upon entering the email/name/password and then pressing next it closes my app to the background. Bringing the app back to the foreground just runs through the lifecycle where it eventually hits the start up check to see if a user is logged in. Since the authentication was successful it forwards to the main activity but this means that onActivityResult is never ever triggered. This is quite annoying.

Further working with this, Google login lets me select an account, and then the dialog closes and nothing, it just sits on the screen to choose facebook/google/email login. Facebook login gives me an error saying my app id is change me when I created my facebook app id string in my string resources file, I assume it isn't looking for it.

@alfongj alfongj added this to the 1.0.0 milestone Sep 20, 2016
amandle pushed a commit to amandle/FirebaseUI-Android that referenced this issue Oct 21, 2016
Don't silently fail if Google Sign In fails firebase#182
amandle pushed a commit to amandle/FirebaseUI-Android that referenced this issue Oct 21, 2016
Don't silently fail if Google Sign In fails firebase#182
amandle pushed a commit to amandle/FirebaseUI-Android that referenced this issue Oct 21, 2016
Don't silently fail if Google Sign In fails firebase#182
@tmontanaro
Copy link

tmontanaro commented Oct 25, 2016

Hi, we encountered the same issue.
However, we noticed a strange behaviour. We are working with 2 different computers:

  • one is equipped with Windows 10, Android Studio 2.2.2.0 and JDK 1.7
  • the other one is equipped with Windows 10, Android Studio 2.2.2.0 and JDK 1.8

We encountered the problem only on the second one (with JDK 1.8): is there anyone who experienced the issue with JDK 1.7? Or, is there anyone that is able to login with an app compiled on a pc that runs JDK 1.8?

@amandle
Copy link
Contributor

amandle commented Oct 25, 2016

@tmontanaro Thanks for the comment! I have a bunch of questions which might help get to the bottom of this. Are you seeing this when using sign in with google Google like @Fax3D? Can you log in using other providers? Are you running in an emulator, or are you seeing this on a device? I have JDK 1.8 installed and it works for me so unfortunately I think that may not be the issue.

@tmontanaro
Copy link

tmontanaro commented Oct 26, 2016

Hello, I will answer to your question in a list to avoid misanderstanding.

  1. Yes, we are seeing this when we try to sign in with Google. As soon as we press the button (Login with Google), we see a loader for about 3-4 seconds, then the loader disappears and nothing else happens.
  2. We did not try with other providers.
  3. We are using some different devices.
    After writing the previous comment in this issue we tryed with different devices and we observed that the problem is not related to the computer with which the apk is generated, but to the device on which it is installed. In fact, even using the apk generated by the pc with JDK 1.7 or the one with JDK 1.8, the login seems to work fine only on some devices.
    We tried with the following devices:
    • LG G5 -> it works
    • Karbonn Sparkle V -> it DOESN'T work
    • Asus Zenfone 2 Laser -> it DOESN'T work
    • 2 Samsung Galaxy S4 -> it DOESN'T work
    • Huawei Mate 8 -> it DOESN'T work
  4. I think the same: after writing my comment in this issue I tryed to generate the apk on the 2 different computers and, testing it on all available devices I deducted that it cannot depend on the platform used to create the apk.

@samtstern
Copy link
Contributor

@tmontanaro although this does seem to be device specific for you, the computer can also matter because each machine will have its own debug keystore and therefore require a different SHA1 registration (unless you are explicitly sharing the keystore across machines).

@tmontanaro
Copy link

tmontanaro commented Oct 28, 2016

Hello, I must apologize: all our (my and my team's) problems were related to the keystore (thank you very much @samtstern ... without you we would have continued to try without success): one of our colleagues changed the SHA1 code on firebase for some personal trials (without warning us) and then we started to have problems.
Even though I cannot understand why on one smartphone it worked even with the wrong key, now, after updating all key related settings (SHA1 on firebase, google-services.json in the app) the login works with all the devices.
Thank you again and sorry!

@carlos-mg89
Copy link

I'm having the same issue as @fabriciointerama however, the most strange thing is that my login process works perfectly fine in Facebook, Gmail and normal email. Even signing anonymously works.

But right after the login is successful, my app (not the activity) is moved to the background. I have to see the apps in the background, and after selecting my app, it resumes the activity that fired the login process (which is my starting activity) and it continues to the main activity.

So login is working perfectly fine. I see the emails that have logged in for all those authentication providers. But the app gets closed immediately after log in, leaving me at the desktop.

I'm using the latest versions for the dependencies. This is my app build.gradle:

apply plugin: 'com.android.application'
apply plugin: 'maven'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'io.fabric'

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath "io.fabric.tools:gradle:$fabric_version"
    }
}

repositories {
    maven { url 'https://maven.fabric.io/public' }
}

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.mypackage.debug"
        minSdkVersion 19
        targetSdkVersion 28
        versionCode 1
        versionName "1.0.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
        vectorDrawables.useSupportLibrary = true
        javaCompileOptions {
            annotationProcessorOptions {
                arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]
            }
        }
    }
    lintOptions {
        checkReleaseBuilds false
    }
    buildTypes {
        debug {
            minifyEnabled false
            applicationIdSuffix ".debug"
        }
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        /**
         * The 'initWith' property allows you to copy configurations from other build types,
         * so you don't have to configure one from the beginning. You can then configure
         * just the settings you want to change. The following line initializes
         * 'jnidebug' using the debug build type, and changes only the
         * applicationIdSuffix and versionNameSuffix settings.
         */
        jnidebug {
            // This copies the debuggable attribute and debug signing configurations.
            initWith debug
            applicationIdSuffix ".jnidebug"
            jniDebuggable true
        }
    }
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
    }
    dataBinding {
        enabled = true
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {
    def room_version = "2.0.0"

    implementation "com.android.support:design:$android_dependencies_version"
    implementation 'androidx.arch.core:core-runtime:2.1.0-beta01'
    implementation "androidx.appcompat:appcompat:1.1.0-alpha05"
    implementation 'androidx.annotation:annotation:1.1.0-rc01'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha5'
    implementation 'androidx.recyclerview:recyclerview:1.1.0-alpha05'
    implementation 'com.android.volley:volley:1.1.0'
    implementation 'com.android.support:multidex:1.0.3'
    implementation 'com.google.code.gson:gson:2.8.5'
    implementation 'com.github.filosganga:geogson-core:1.2.21'
    implementation 'com.github.filosganga:geogson-jts:1.2.21'
    implementation 'com.google.firebase:firebase-core:16.0.9'
    implementation 'com.google.firebase:firebase-messaging:18.0.0'
    implementation 'com.google.firebase:firebase-auth:17.0.0'
    implementation 'com.facebook.android:facebook-android-sdk:5.0.0'
    implementation 'com.firebaseui:firebase-ui-auth:4.3.2'
    implementation('com.crashlytics.sdk.android:crashlytics:2.9.9@aar') {
        transitive = true
    }
    implementation 'io.swagger:swagger-annotations:1.5.21'
    implementation 'org.apache.httpcomponents:httpcore:4.4.11'
    implementation 'org.apache.httpcomponents:httpmime:4.5.8'
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.27.0-eap13'
    implementation 'com.carto:carto-mobile-sdk:4.1.6@aar'
    implementation 'com.mapzen.android:lost:3.0.4'
    implementation 'com.graphhopper:directions-api-client-hc:0.10.3'
    implementation 'com.andkulikov:transitionseverywhere:2.0.0-beta01'
    implementation 'com.flickr4java:flickr4java:3.0.1'
    implementation 'com.github.PhilJay:MPAndroidChart:3.1.0-alpha'
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    testImplementation 'junit:junit:4.13-beta-2'
    testImplementation 'org.robolectric:robolectric:4.3-alpha-2'
    testImplementation 'net.jodah:concurrentunit:0.4.4'
    androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation "androidx.room:room-runtime:$room_version"
    implementation "androidx.lifecycle:lifecycle-extensions:$room_version"
    testImplementation "androidx.room:room-testing:$room_version"
    annotationProcessor "androidx.room:room-compiler:$room_version"
    kapt "androidx.room:room-compiler:$room_version"
    implementation 'com.github.humazed:RoomAsset:1.0.3'
    implementation 'com.fasterxml.jackson.core:jackson-core:2.9.8'
    implementation 'com.fasterxml.jackson.core:jackson-annotations:2.9.8'
    implementation 'com.fasterxml.jackson.core:jackson-databind:2.9.8'
    implementation 'com.jmedeisis:draglinearlayout:1.1.0'
    implementation 'io.github.kobakei:ratethisapp:1.2.0'
    implementation 'org.jetbrains.anko:anko-common:0.9'

    implementation 'com.squareup.picasso:picasso:2.71828'
    implementation 'com.yarolegovich:discrete-scrollview:1.4.9'
    implementation 'com.google.android.gms:play-services-vision:17.0.2'
    implementation "com.google.android.gms:play-services-auth:16.0.1"
}

configurations.all {
    // Check for updates every build
    resolutionStrategy.cacheChangingModulesFor 0, 'seconds'

    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == "com.android.support") {
            if (!requested.name.startsWith("multidex")) {
                details.useVersion "26.+"
            }
        }
    }

    all*.exclude group: 'com.google.guava', module: 'listenablefuture'
}

task instrumentTest(dependsOn: connectedCheck)

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

@carlos-mg89
Copy link

carlos-mg89 commented May 10, 2019

Yesterday I forgot to mention that I had reviewed @janakagamini comment, so just to double check and discard possible missing configurations, here is the 'whole' picture:

  1. Internet permissions are included in the app manifest
  2. The play services library is included as dependency. It's on the last line of the dependencies block on my app's build.gradle.
  3. In the last line of my app's build gradle, there is as well the apply plugin for the google-services, as I read it had to be there (at the bottom of the file). I didn't change it at any moment actually, it had been already there.
  4. I've double checked that I have the correct SHA1 of my debug key. It didn't log in properly until I wrote the correct one, since it was written the SHA1 of another computer.
  5. The package name is right, otherwise I wouldn't be able to log in, right?

So summarizing my situation again, apparently the configuration is all right. However, after a successful login, my app moves to the background, leaving me at the desktop of my Android emulator (tested as well on a physical device with the same result).

I'm using the default Firebase Auth UI. The code I use to start the activity is this one:

override fun onResume() {
        super.onResume()

        val mAuth = FirebaseAuth.getInstance()
        val currentUser = mAuth?.currentUser

        if (currentUser == null) {
            requireFirebaseLogin()
        }
}

private fun requireFirebaseLogin() {
        val providers = arrayListOf(
                AuthUI.IdpConfig.AnonymousBuilder().build(),
                AuthUI.IdpConfig.EmailBuilder().build(),
                AuthUI.IdpConfig.FacebookBuilder().build(),
                AuthUI.IdpConfig.GoogleBuilder().build())

        startActivityForResult(
                AuthUI.getInstance()
                        .createSignInIntentBuilder()
                        .setAvailableProviders(providers)
                        .setLogo(R.mipmap.logo)
                        .build(),
                RequestCodes.FIREBASE_SIGN_IN)
    }

override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
        super.onActivityResult(requestCode, resultCode, data)

        if (requestCode == RequestCodes.FIREBASE_SIGN_IN) {
            val response = IdpResponse.fromResultIntent(data)

            if (resultCode == Activity.RESULT_OK) {
                mapApplication.firebaseAuth = mAuth
                initSetup()
            } else {
                // Sign in failed. If response is null the firebaseAuth canceled the
                // sign-in flow using the back button. Otherwise check
                // response.getError().getErrorCode() and handle the error.
            }
        }

    }

@carlos-mg89
Copy link

@dcalano did you solve your problem? It definitely seems mine is like yours.

@amostyaev
Copy link

amostyaev commented Jul 2, 2019

I'm facing similar behaviour.

Changing
implementation "androidx.appcompat:appcompat:1.1.0-alpha05"
to
implementation "androidx.appcompat:appcompat:1.0.2"

solves the issue. I hope appcompat library will be fixed soon.

@itrevex
Copy link

itrevex commented Jul 10, 2019

I was having this issue because I had set no history for the activity calling the firebase ui in the manifest file. Removing android:noHistory="true" from the activity inside manifest solved the problem

@carlos-mg89
Copy link

@itrevex actually I have the noHistory attribute set to true. Thanks for this valuable data!

Although at the end I built my own customized login / sign up process using the Firebase library.

@Amrandroid
Copy link

Actually make sure that private static final int RC_SIGN_IN =1 ;
not -1

@vahanpx
Copy link

vahanpx commented May 27, 2021

I had the same issue; In my case the problem was that I was trying to login from fragment and passing to google sign in client activity as context and listening onActivityResult inside activity, then I change:

val googleSignInClient = GoogleSignIn.getClient(requireActivity(), gso)

to

val googleSignInClient = GoogleSignIn.getClient(requireContext(), gso)

and listen onActivityResult inside fragment and it triggered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.