NoClassDefFoundError: Failed resolution of: Landroid/view/View$OnUnhandledKeyEventListener

Phenomenon.

Android When I built the app in Things, there was an error log in Logcat.

This error didn’t seem to appear before…
The app doesn’t force-quit, it just runs an error log, which is strange.

Error log.

Logcat

Solution.

I looked it up and this is Android Things are not the problem, but a bug in AndroidX seemingly

Add implementation 'androidx. core:1.5.0-alpha01' to app/build.gradle and the error disappeared. core:core:1.5.0-alpha01’` to app/build.gradle, the error disappeared.

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "org.jetbrains.kotlin:kotlin- stdlib:$kotlin_version"
    implementation 'androidx.core:core-ktx:1.3.0 '
+ implementation 'androidx.core:core:1.5.0- alpha01'
    implementation 'androidx.appcompat:appcompat :1.1.0'
    implementation 'androidx.constraintlayout: constraintlayout:1.1.3'

[android](http://d.hatena.ne.jp/keyword/ There is an Issue in (android)/sunflower with the same error, and then you can try to fix it with Solution.

[github.com](https://github.com/android/ sunflower/issues/295#issuecomment-649630057 )

I wonder what this bug is.

I’m sure it’ll get better in time.

Environment

Android Studio 4.0

app/build.gradle

    compileSdkVersion 29
    buildToolsVersion "29.0.3"

    defaultConfig {
        applicationId "com.ikemura.smarthouse"
        minSdkVersion 24
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
Share