WindSekirun / RxSocialLogin

An Android Library that provides social login for 15 platforms within by RxJava2, Kotlin and Firebase Authentication.
Apache License 2.0
125 stars 19 forks source link

Error in Fragment: “Already managing a GoogleApiClient with id 0” #44

Open dogeri28 opened 5 years ago

dogeri28 commented 5 years ago

Your library crashes when it the functionality is placed in a fragment. the solution is in this link below. you will need to override the onPause

https://stackoverflow.com/questions/36105118/error-in-fragment-already-managing-a-googleapiclient-with-id-0

WindSekirun commented 5 years ago

I implement RxSocialLogin.addLifecycleEvent(lifecycle: Lifecycle) and RxSocialLogin.removeLifecycleEvent(lifecycle: Lifecycle) methods in RxSocialLogin class.

These methods can (de)observe Lifecycle(androidx.lifecycle) event, execute lifecycle-related event automatically when lifecycle has changed in Activity and Fragment.

Just execute RxSocialLogin.addLifecycleEvent(getLifecycle()) in fragment will be fine.

If you don't use Lifecycle components, then you can call RxSocialLogin.getLoginModule(PlatformType.Google).onPauseEvent(). this method execute same thing.

Snapshot build wil availble in 20 minutes, please test and notice me.

WindSekirun commented 5 years ago

Snapshot : implementation 'com.github.WindSekirun:RxSocialLogin:48ce885917'

dogeri28 commented 5 years ago

Snapshot not building in my environment causes gradle to crash with

18-91 Error: Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91 is also present at [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory). Suggestion: add 'tools:replace="android:appComponentFactory"' to element at AndroidManifest.xml:23:5-72:19 to override.

WindSekirun commented 5 years ago

It seems you don't use androidx in your project.

Starting with the next release, i will be releasing only androidx, but i'll work with another branch and deploy a snapshot that does not use androidx.

WindSekirun commented 5 years ago

Snapshot: implementation 'com.github.WindSekirun:RxSocialLogin:373539f712'

dogeri28 commented 5 years ago

Thanks, i decided to use the normal google login and resolved the issue. i will still use yours but wanted to be sure i could address the issue

WindSekirun commented 5 years ago

I don't have much time to manage library until End of December, so I can't be sure I can resolve an issue at now. If you can, please provide sample code to reproduce this issue? it can help when resolving this issue.