firebase / FirebaseUI-Android

Optimized UI components for Firebase
https://firebaseopensource.com/projects/firebase/firebaseui-android/
Apache License 2.0
4.63k stars 1.84k forks source link

firebase.ui.auth.KickoffActivity does not implement interface LifecycleOwner #1395

Closed Hishmad closed 6 years ago

Hishmad commented 6 years ago

Hello, The app was running well with firebase UI before 3.1.0, but when moving to firebase UI 4.1.0 the app crash with the following information:

Step 1: Are you in the right place?

Yes

Step 2: Describe your environment

Step 3: Describe the problem:

Application crash firebase.ui.auth.KickoffActivity does not implement interface LifecycleOwner

07-20 10:00:10.748 18595-18595/id.iternak.iternakdetail E/AndroidRuntime: FATAL EXCEPTION: main
    Process: id.iternak.iternakdetail, PID: 18595
    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/id.iternak.iternakdetail-Dh9zxLu0pMKCvPUh9kqoTg==/split_lib_dependencies_apk.apk)
        at android.arch.lifecycle.LiveData.observe(LiveData.java:166)
        at com.firebase.ui.auth.KickoffActivity.onCreate(KickoffActivity.java:35)
        at android.app.Activity.performCreate(Activity.java:7174)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1220)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2910)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3032)
        at android.app.ActivityThread.-wrap11(Unknown Source:0)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1696)
        at android.os.Handler.dispatchMessage(Handler.java:105)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6944)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)

app/build.gradle

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion 27
    buildToolsVersion '27.0.3'
    defaultConfig {
        applicationId "id.iternak.iternakdetail"
        minSdkVersion 21
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    configurations.all {
        resolutionStrategy.eachDependency { DependencyResolveDetails details ->
            def requested = details.requested
            if (requested.group == 'com.android.support') {
                if (!requested.name.startsWith("multidex")) {
                    details.useVersion '26.0.2'
                }
            }
        }
    }

}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.android.support:appcompat-v7:27.1.1'
    testImplementation 'junit:junit:4.12'
    implementation "android.arch.lifecycle:extensions:$lifecycle_version"
    implementation 'com.android.support:support-v4:27.1.1'
    implementation 'com.android.support:support-v13:27.1.1'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    implementation 'android.arch.lifecycle:runtime:1.1.1'
    implementation 'com.google.firebase:firebase-core:16.0.1'
    implementation 'com.google.firebase:firebase-database:16.0.1'
    implementation 'com.google.firebase:firebase-storage:16.0.1'
    implementation 'com.google.android.gms:play-services-auth:15.0.1'
    implementation 'com.google.firebase:firebase-auth:16.0.1'
    implementation 'com.firebaseui:firebase-ui-auth:4.1.0'
    implementation "org.jetbrains.anko:anko-common:$anko_version"
    implementation 'com.github.bumptech.glide:glide:4.1.1'
    implementation 'android.arch.lifecycle:extensions:1.1.1'
    implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
    implementation 'io.reactivex.rxjava2:rxkotlin:2.2.0'

    annotationProcessor 'com.github.bumptech.glide:compiler:4.1.1'

}

// Add to the bottom of the file
apply plugin: 'com.google.gms.google-services'

project.build.gradle

   buildscript {
    ext.kotlin_version = '1.2.51'
    ext.anko_version = '0.10.1'
    ext.lifecycle_version = '1.1.1'
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.3'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.0.1'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        mavenCentral()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Expected Results:

Login screen

samtstern commented 6 years ago

Same issue as #1274, but not sure that was ever resolved ... something is pulling in the wrong version of the support library where AppCompatActivity is not a LifecycleOwner.

Hishmad commented 6 years ago

Hi Sam, Its true same issue as #1274, I have followed your recommendation, but it did't work. I have three apps all of them using firebase-ui they are all fine, with version 3.1.0.

samtstern commented 6 years ago

Ah wait, now I see this:

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

That's forcing all your support dependencies to be overridden at version 26.0.2! Please update that to something like 27.0.1.

As you can see in the release notes, 3.1.0 was one of the last versions that depended on 26.x so that's why it used to work: https://github.com/firebase/FirebaseUI-Android/releases?after=3.1.2

Hishmad commented 6 years ago

Noted with many thanks