android.view.View$OnUnhandledKeyEventListener

后端 未结 9 2452
难免孤独
难免孤独 2020-12-08 09:03

I am new to Android Studio and I don\'t get why my toolbar isn\'t shown as described by https://developer.android.com/training/appbar/setting-up I know there are already som

相关标签:
9条回答
  • 2020-12-08 09:35

    https://github.com/DonaldDu/FixUnhandledEvent

    android.view.View$OnUnhandledKeyEventListener is add in api28.

    If runtime device below 28, can't find the class, but run without fatal error.

    We can inject the class in debug mode to ignore error message.

    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    //inject class when api<28 && debug==true
    debugImplementation 'com.github.DonaldDu:FixUnhandledEvent:1.0'
    
    0 讨论(0)
  • 2020-12-08 09:36

    If using Android X and androidx.core:core and/or androidx.appcompat:appcompat, update androidx.core:core to 1.4.0-alpha01 and/or androidx.appcompat:appcompat to 1.3.0-alpha01

    0 讨论(0)
  • 2020-12-08 09:40

    It's not an error but a warning it can be ignored by the addition of the following code in my build.gradle (app level) the file works in my case. Then sync and build the project. Hopefully, it fixes the issue.

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

    Reference to the gist

    0 讨论(0)
  • 2020-12-08 09:41

    There's problem with library ~-v7:28.0.0. There are two solutions, your can either download compile and targetSdkVersion to 27 or upgrade Android Studio to latest version (3.2.x higher).

    0 讨论(0)
  • 2020-12-08 09:48

    Downgrading to sdk 27 as one of the other post suggested came with a new set of problems for me. see: Android - resource linking failed / failed linking references

    Adding an entry to my build.gradle (app level) solved the issue for me.

    dependencies {
        ...
    
        implementation 'androidx.core:core:1.4.0-alpha01'
        ...
    }
    

    Here's where I got the idea to try this: https://github.com/android/sunflower/issues/295#issuecomment-649630057

    0 讨论(0)
  • 2020-12-08 09:50

    Add multidex support library to your dependencies

    com.android.support:multidex:1.0.3
    
    0 讨论(0)
提交回复
热议问题