Roman Nazarevych
Roman Nazarevych

Reputation: 7703

androidx.appcompat.app.AppCompatActivity doesn't implement LifecycleOwner

I know looks like some stupid error, but I cannot find it. In my project I have access to LifecycleOwner from my Fragments but not from Activity.

Here is my build.gradle

implementation project(':domain')
implementation project(':data')
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.1.1'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.1.1'
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.core:core-ktx:1.1.0-alpha05'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'

// Koin for Android
implementation "org.koin:koin-android:$koin_version"
implementation "org.koin:koin-androidx-viewmodel:$koin_version"

// Anko
implementation "org.jetbrains.anko:anko-commons:$anko_version"
implementation "org.jetbrains.anko:anko-sdk15-listeners:$anko_version"

//Architecture components
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"

Here is the Activity code: enter image description here

And this is the source code of AppCompatActivity enter image description here

Upvotes: 5

Views: 2959

Answers (2)

Sam
Sam

Reputation: 5392

It's your core library. Also general rule of thumb for production code, try to avoid using alpha. Update the following libraries and you should be fine.

implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.0.1'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.0.1'

Upvotes: 0

ianhanniballake
ianhanniballake

Reputation: 200020

As per this issue, this is a known issue if you use core-ktx:1.1.0 and appcompat:1.0.2, mixing alpha versions with stable releases. Upgrade to appcompat:1.1.0-alpha03 to fix the issue:

implementation 'androidx.appcompat:appcompat:1.1.0-alpha03'

Upvotes: 14

Related Questions