Firebaseui-android: Firebaseui auth - does not implement interface 'android.arch.lifecycle.LifecycleOwner'

Created on 27 Apr 2018  路  11Comments  路  Source: firebase/FirebaseUI-Android

Step 1: Are you in the right place?

Yes

Step 2: Describe your environment

  • Android device: Moto Maxx
  • Android OS version: 6.0.1
  • Google Play Services version: NA
  • Firebase/Play Services SDK version: 15.0.0
  • FirebaseUI version: 3.3.1

Step 3: Describe the problem:

app crashes when starting firebaseui-auth

Observed Results:

FATAL EXCEPTION: main
                  Process: com.hyperlista, PID: 16872
                  java.lang.IncompatibleClassChangeError: Class 'com.firebase.ui.auth.KickoffActivity' does not implement interface 'android.arch.lifecycle.LifecycleOwner' in call to 'android.arch.lifecycle.Lifecycle android.arch.lifecycle.LifecycleOwner.getLifecycle()' (declaration of 'android.arch.lifecycle.LiveData' appears in /data/app/com.hyperlista-2/split_lib_dependencies_apk.apk)
                      at android.arch.lifecycle.LiveData.observe(LiveData.java:166)
                      at com.firebase.ui.auth.KickoffActivity.onCreate(KickoffActivity.java:34)
                      at android.app.Activity.performCreate(Activity.java:6259)
                      at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1130)
                      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2379)
                      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2490)
                      at android.app.ActivityThread.-wrap11(ActivityThread.java)
                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1354)
                      at android.os.Handler.dispatchMessage(Handler.java:102)
                      at android.os.Looper.loop(Looper.java:148)
                      at android.app.ActivityThread.main(ActivityThread.java:5443)
                      at java.lang.reflect.Method.invoke(Native Method)
                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
  ```

#### Relevant Code:

```java
 startActivityForResult(
                AuthUI.getInstance()
                        .createSignInIntentBuilder()
                        .setAvailableProviders(Arrays.asList(
                                AuthUI.IdpConfig.EmailBuilder().build(),
                                AuthUI.IdpConfig.GoogleBuilder().build()))
                        .build(),
                RC_SIGN_IN)

Most helpful comment

I had somewhat similar issue and commenting out "implementation 'androidx.core:core:1.1.0-alpha02" solved it for me.

All 11 comments

@miltonmartins can you show the dependencies block from your app's build.gradle?

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    implementation 'com.google.firebase:firebase-config:15.0.0'
    implementation 'com.google.firebase:firebase-core:15.0.0'
    implementation 'com.google.firebase:firebase-crash:15.0.0'
    implementation 'com.google.firebase:firebase-database:15.0.0'
    implementation 'com.google.firebase:firebase-firestore:15.0.0'
    implementation 'com.google.firebase:firebase-storage:15.0.0'
    implementation 'com.google.firebase:firebase-auth:15.0.0'
    implementation('com.crashlytics.sdk.android:crashlytics:2.7.1@aar') {
        transitive = true
    }

    implementation 'com.firebaseui:firebase-ui-auth:3.3.1'
    implementation 'com.firebaseui:firebase-ui-storage:3.3.1'

    implementation 'com.google.android.gms:play-services-maps:15.0.0'
    implementation 'com.google.maps.android:android-maps-utils:0.5'

    implementation 'com.android.support:design:26.2.1'
    implementation 'com.android.support:support-v4:26.1.0'
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support:recyclerview-v7:26.1.0'
    implementation 'com.android.support:palette-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.0'
    implementation 'com.github.chrisbanes:PhotoView:2.0.0'
    implementation project(':timeline')

    testImplementation 'junit:junit:4.12'
    androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.0', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    implementation 'com.android.support:mediarouter-v7:26.2.1'
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.google.code.gson:gson:2.8.0'
    implementation 'net.hockeyapp.android:HockeySDK:5.1.0'

    implementation 'com.github.bumptech.glide:glide:4.6.1'
    kapt 'com.github.bumptech.glide:compiler:4.6.1'

    implementation 'com.google.android.gms:play-services-auth:15.0.0'
    implementation 'com.google.android.gms:play-services-cast-framework:15.0.0'
}

Hmm I am surprised by this since KickoffActivity comes from AppCompatActivity which has implemented LifeCycleOwner since support lib 26.1.0, which you have:
https://developer.android.com/topic/libraries/support-library/revisions#26-1-0

@miltonmartins could you try replacing all of your 26.1.0 dependencies with 27.1.0 or 27.1.1?

If that's not an option, add this dependency:
implementation 'android.arch.lifecycle:runtime:1.1.0'

@miltonmartins going to close this one since it has been inactive for 10 days an I can't reproduce. Let me know if you want to continue and we can re-open it.

Hello: Yes I have the same problem like @miltonmartins
@samtstern I replaced to 27.1.1 as you recomend
but my apps crash

Same here: Using Android X
java.lang.IncompatibleClassChangeError: Class 'com.firebase.ui.auth.KickoffActivity' does not implement interface 'androidx.lifecycle.LifecycleOwner' in call to 'androidx.lifecycle.Lifecycle androidx.lifecycle.LifecycleOwner.getLifecycle()' (declaration of 'androidx.lifecycle.LiveData' appears in /data/app/-GmLOsMRYOmQxMy1_jAp1uA==/base.apk)

I had somewhat similar issue and commenting out "implementation 'androidx.core:core:1.1.0-alpha02" solved it for me.

I've had the same issue and after nothing seemed to fix it. I was almost giving up.
However, as a last try a I added
android.arch.core:core:1.0.0-alpha3 and
androidx.core:core:1.1.1-alpha2

The build failed and removing these two again and going back to the original dependency set fixed the error and things are working now. If this works for someone!

Similar to @fezzab I had the same issue after migrating to Android. After trying almost everything, what worked was commenting out
implementation 'com.firebaseui:firebase-ui-database:4.3.0'
Syncing with gradle and uncommenting that line and syncing.

Hope this helps someone!

It helped for me:
implementation "androidx.appcompat:appcompat:1.1.0-beta01"

Was this page helpful?
0 / 5 - 0 ratings