I was just trying to update my project from targetSDK version 33 to to 34. For that I need to update some lifecyle apis as well. Prevously I was using these versions
//LifeCycle
implementation 'androidx.lifecycle:lifecycle-common:2.2.0'
implementation 'androidx.lifecycle:lifecycle-runtime:2.2.0'
implementation 'android.arch.lifecycle:extensions:2.2.0'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.2.0'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.2.0'
Which I updated with
//LifeCycle
def lifecycle_version = "2.8.3"
def arch_version = "2.2.0"
// ViewModel
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
// LiveData
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
// Lifecycles only (without ViewModel or LiveData)
implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
// Saved state module for ViewModel
implementation "androidx.lifecycle:lifecycle-viewmodel-savedstate:$lifecycle_version"
// Annotation processor
kapt "androidx.lifecycle:lifecycle-compiler:$lifecycle_version"
But now its showing error which I'm not understanding.
Error
* Task :app:mergeExtDexDebug FAILED AGPBI: {"kind":"error","text":"java.lang.NullPointerException","sources":[{"file":"/Users/apple/.gradle/caches/transforms-3/826f48ce73a7e66fbb6d1694a1db726c/transformed/lifecycle-livedata-core-2.8.3-runtime.jar"}],"tool":"D8"} *
What I already tried:
Please help me if anyone faced this issue or have any idea about. Thnks
two methods:
update the project to use AGP 8.4.0 or a later version. ref
downgrade lifecycle_version to 2.7.0