NoSuchMethodError getLifeCycle()

时间:2019-06-25 06:02:46

标签: android android-activity

我已将此库从implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta1'更新为implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta2'

自此更新以来,出现崩溃:

No super method getLifecycle()Landroidx/lifecycle/Lifecycle; in class Landroidx/core/app/ComponentActivity; or its super classes (declaration of 'androidx.core.app.ComponentActivity' appears in /data/app/com.xxx-_17DxVaMzNmc19qlXpUTYw==/base.apk)

此调用在我的活动(扩展了AppCompatActivity)中完成。

你们有一些解释吗?

3 个答案:

答案 0 :(得分:1)

我已解决此问题,以将这种依赖关系从implementation 'androidx.appcompat:appcompat:1.0.2'升级到implementation 'androidx.appcompat:appcompat:1.1.0-beta01'

奇怪的行为...反正是固定的!

也非常感谢你们的支持!

答案 1 :(得分:0)

use @ViewChild(MatInput | MatSelect, {read: ElementRef})elementRef;

答案 2 :(得分:0)

尝试一下 为我工作

apply plugin: 'com.A.B'

android {
dataBinding {
    enabled = true
}
compileSdkVersion 28
defaultConfig {
    applicationId "com.A.B"
    minSdkVersion 21
    targetSdkVersion 28
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
}
compileOptions {
    sourceCompatibility = '1.8'
    targetCompatibility = '1.8'
 }
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

implementation 'com.android.support:design:28.0.0' //design

annotationProcessor "android.arch.lifecycle:compiler:1.1.1"
implementation "android.arch.lifecycle:extensions:1.1.1"

}

并在build.gradle(项目)中添加:

        classpath 'com.android.tools.build:gradle:3.4.1'