我尝试使用Android 3.4 Canary 4和targetSdkVersion 28创建基本示例项目,但在setContentView(R.layout.activity_main)
出现了以下错误,并且没有任何视图交互。
Rejecting re-init on previously-failed class java.lang.Class<android.support.v4.view.ViewCompat$OnUnhandledKeyEventListenerWrapper>: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/view/View$OnUnhandledKeyEventListener;
2018-11-09 14:01:46.696 22177-22177/com.example.unittest I/zygote: at void android.support.v4.view.ViewCompat.setOnApplyWindowInsetsListener(android.view.View, android.support.v4.view.OnApplyWindowInsetsListener) (ViewCompat.java:2203)
2018-11-09 14:01:46.696 22177-22177/com.example.unittest I/zygote: at android.view.ViewGroup android.support.v7.app.AppCompatDelegateImpl.createSubDecor() (AppCompatDelegateImpl.java:637)
2018-11-09 14:01:46.696 22177-22177/com.example.unittest I/zygote: at void android.support.v7.app.AppCompatDelegateImpl.ensureSubDecor() (AppCompatDelegateImpl.java:518)
2018-11-09 14:01:46.696 22177-22177/com.example.unittest I/zygote: at void android.support.v7.app.AppCompatDelegateImpl.setContentView(int) (AppCompatDelegateImpl.java:466)
2018-11-09 14:01:46.696 22177-22177/com.example.unittest I/zygote: at void android.support.v7.app.AppCompatActivity.setContentView(int) (AppCompatActivity.java:140)
2018-11-09 14:01:46.696 22177-22177/com.example.unittest I/zygote: at void com.example.unittest.MainActivity.onCreate(android.os.Bundle) (MainActivity.kt:14)
2018-11-09 14:01:46.697 22177-22177/com.example.unittest I/zygote: at void android.app.Activity.performCreate(android.os.Bundle, android.os.PersistableBundle) (Activity.java:7032)
2018-11-09 14:01:46.697 22177-22177/com.example.unittest I/zygote: at void android.app.Activity.performCreate(android.os.Bundle) (Activity.java:7023)
2018-11-09 14:01:46.697 22177-22177/com.example.unittest I/zygote: at void android.app.Instrumentation.callActivityOnCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:1236)
2018-11-09 14:01:46.697 22177-22177/com.example.unittest I/zygote: at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:2814)
2018-11-09 14:01:46.697 22177-22177/com.example.unittest I/zygote: at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:2943)
2018-11-09 14:01:46.697 22177-22177/com.example.unittest I/zygote: at void android.app.ActivityThread.-wrap11(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1)
2018-11-09 14:01:46.697 22177-22177/com.example.unittest I/zygote: at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1630)
2018-11-09 14:01:46.697 22177-22177/com.example.unittest I/zygote: at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:106)
2018-11-09 14:01:46.697 22177-22177/com.example.unittest I/zygote: at void android.os.Looper.loop() (Looper.java:164)
2018-11-09 14:01:46.697 22177-22177/com.example.unittest I/zygote: at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6626)
2018-11-09 14:01:46.697 22177-22177/com.example.unittest I/zygote: at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
2018-11-09 14:01:46.697 22177-22177/com.example.unittest I/zygote: at void com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run() (RuntimeInit.java:438)
2018-11-09 14:01:46.697 22177-22177/com.example.unittest I/zygote: at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:811)
2018-11-09 14:01:46.697 22177-22177/com.example.unittest I/zygote: Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.View$OnUnhandledKeyEventListener" on path: DexPathList[[zip file "/data/app/com.example.unittest-vDwAsULhTFVq1v0sau4t5g==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.unittest-vDwAsULhTFVq1v0sau4t5g==/lib/arm, /system/lib, /system/vendor/lib]]
2018-11-09 14:01:46.697 22177-22177/com.example.unittest I/zygote: at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:125)
2018-11-09 14:01:46.697 22177-22177/com.example.unittest I/zygote: at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:379)
2018-11-09 14:01:46.697 22177-22177/com.example.unittest I/zygote: at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
2018-11-09 14:01:46.697 22177-22177/com.example.unittest I/zygote: at void android.support.v4.view.ViewCompat.setOnApplyWindowInsetsListener(android.view.View, android.support.v4.view.OnApplyWindowInsetsListener) (ViewCompat.java:2203)
2018-11-09 14:01:46.697 22177-22177/com.example.unittest I/zygote: at android.view.ViewGroup android.support.v7.app.AppCompatDelegateImpl.createSubDecor() (AppCompatDelegateImpl.java:637)
2018-11-09 14:01:46.697 22177-22177/com.example.unittest I/zygote: at void android.support.v7.app.AppCompatDelegateImpl.ensureSubDecor() (AppCompatDelegateImpl.java:518)
2018-11-09 14:01:46.697 22177-22177/com.example.unittest I/zygote: at void android.support.v7.app.AppCompatDelegateImpl.setContentView(int) (AppCompatDelegateImpl.java:466)
2018-11-09 14:01:46.697 22177-22177/com.example.unittest I/zygote: at void android.support.v7.app.AppCompatActivity.setContentView(int) (AppCompatActivity.java:140)
2018-11-09 14:01:46.697 22177-22177/com.example.unittest I/zygote: at void com.example.unittest.MainActivity.onCreate(android.os.Bundle) (MainActivity.kt:14)
2018-11-09 14:01:46.697 22177-22177/com.example.unittest I/zygote: at void android.app.Activity.performCreate(android.os.Bundle, android.os.PersistableBundle) (Activity.java:7032)
2018-11-09 14:01:46.697 22177-22177/com.example.unittest I/zygote: at void android.app.Activity.performCreate(android.os.Bundle) (Activity.java:7023)
2018-11-09 14:01:46.697 22177-22177/com.example.unittest I/zygote: at void android.app.Instrumentation.callActivityOnCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:1236)
2018-11-09 14:01:46.697 22177-22177/com.example.unittest I/zygote: at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:2814)
2018-11-09 14:01:46.697 22177-22177/com.example.unittest I/zygote: at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:2943)
2018-11-09 14:01:46.697 22177-22177/com.example.unittest I/zygote: at void android.app.ActivityThread.-wrap11(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1)
2018-11-09 14:01:46.697 22177-22177/com.example.unittest I/zygote: at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1630)
2018-11-09 14:01:46.697 22177-22177/com.example.unittest I/zygote: at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:106)
2018-11-09 14:01:46.697 22177-22177/com.example.unittest I/zygote: at void android.os.Looper.loop() (Looper.java:164)
2018-11-09 14:01:46.697 22177-22177/com.example.unittest I/zygote: at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6626)
2018-11-09 14:01:46.697 22177-22177/com.example.unittest I/zygote: at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
2018-11-09 14:01:46.697 22177-22177/com.example.unittest I/zygote: at void com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run() (RuntimeInit.java:438)
2018-11-09 14:01:46.697 22177-22177/com.example.unittest I/zygote: at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:811)