質問: noclassdeffounderrorの解決方法:landroid / view / view $ onunhandledkeyeventlistenerの解決に失敗しました。 android studioをアップグレードしましたandroid studio 3.2 build #ai-181.5540.7.32.5014246, built on september 17, 2018 jre: 1.8.0_152-release-1136-b06 x86_64 jvm: openjdk 64-bit server vm by jetbrains s.r.o mac os x 10.11.6 空のアクティビティテンプレートを使用して新しいプロジェクトを作成しますsync gradle clean build run 私のアプリケーションのlogcatは起動時にこの例外を表示します2018-09-27 13:51:41.116 22090-22090/? i/zygote64: 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-09-27 13:51:41.116 22090-22090/? i/zygote64: at void android.support.v4.view.viewcompat.setbackground(android.view.view, android.graphics.drawable.drawable) (viewcompat.java:2341) 2018-09-27 13:51:41.116 22090-22090/? i/zygote64: at void android.support.v7.widget.actionbarcontainer.<init>(android.content.context, android.util.attributeset) (actionbarcontainer.java:62) 2018-09-27 13:51:41.116 22090-22090/? i/zygote64: at java.lang.object java.lang.reflect.constructor.newinstance0(java.lang.object[]) (constructor.java:-2) 2018-09-27 13:51:41.116 22090-22090/? i/zygote64: at java.lang.object java.lang.reflect.constructor.newinstance(java.lang.object[]) (constructor.java:334) 2018-09-27 13:51:41.116 22090-22090/? i/zygote64: at android.view.view android.view.layoutinflater.createview(java.lang.string, java.lang.string, android.util.attributeset) (layoutinflater.java:647) 2018-09-27 13:51:41.116 22090-22090/? i/zygote64: at android.view.view android.view.layoutinflater.createviewfromtag(android.view.view, java.lang.string, android.content.context, android.util.attributeset, boolean) (layoutinflater.java:790) 2018-09-27 13:51:41.116 22090-22090/? i/zygote64: at android.view.view android.view.layoutinflater.createviewfromtag(android.view.view, java.lang.string, android.content.context, android.util.attributeset) (layoutinflater.java:730) 2018-09-27 13:51:41.116 22090-22090/? i/zygote64: at void android.view.layoutinflater.rinflate(org.xmlpull.v1.xmlpullparser, android.view.view, android.content.context, android.util.attributeset, boolean) (layoutinflater.java:863) 2018-09-27 13:51:41.116 22090-22090/? i/zygote64: at void android.view.layoutinflater.rinflatechildren(org.xmlpull.v1.xmlpullparser, android.view.view, android.util.attributeset, boolean) (layoutinflater.java:824) 2018-09-27 13:51:41.116 22090-22090/? i/zygote64: at android.view.view android.view.layoutinflater.inflate(org.xmlpull.v1.xmlpullparser, android.view.viewgroup, boolean) (layoutinflater.java:515) 2018-09-27 13:51:41.116 22090-22090/? i/zygote64: at android.view.view android.view.layoutinflater.inflate(int, android.view.viewgroup, boolean) (layoutinflater.java:423) 2018-09-27 13:51:41.116 22090-22090/? i/zygote64: at android.view.view android.view.layoutinflater.inflate(int, android.view.viewgroup) (layoutinflater.java:374) 2018-09-27 13:51:41.116 22090-22090/? i/zygote64: at android.view.viewgroup android.support.v7.app.appcompatdelegateimpl.createsubdecor() (appcompatdelegateimpl.java:607) 2018-09-27 13:51:41.116 22090-22090/? i/zygote64: at void android.support.v7.app.appcompatdelegateimpl.ensuresubdecor() (appcompatdelegateimpl.java:518) 2018-09-27 13:51:41.116 22090-22090/? i/zygote64: at void android.support.v7.app.appcompatdelegateimpl.setcontentview(int) (appcompatdelegateimpl.java:466) 2018-09-27 13:51:41.116 22090-22090/? i/zygote64: at void android.support.v7.app.appcompatactivity.setcontentview(int) (appcompatactivity.java:140) 2018-09-27 13:51:41.116 22090-22090/? i/zygote64: at void com.manacle.secondmanacle.mainactivity.oncreate(android.os.bundle) (mainactivity.java:11) 2018-09-27 13:51:41.116 22090-22090/? i/zygote64: at void android.app.activity.performcreate(android.os.bundle, android.os.persistablebundle) (activity.java:7009) 2018-09-27 13:51:41.116 22090-22090/? i/zygote64: at void android.app.activity.performcreate(android.os.bundle) (activity.java:7000) 2018-09-27 13:51:41.116 22090-22090/? i/zygote64: at void android.app.instrumentation.callactivityoncreate(android.app.activity, android.os.bundle) (instrumentation.java:1214) 2018-09-27 13:51:41.116 22090-22090/? i/zygote64: at android.app.activity android.app.activitythread.performlaunchactivity(android.app.activitythread$activityclientrecord, android.content.intent) (activitythread.java:2731) 2018-09-27 13:51:41.116 22090-22090/? i/zygote64: at void android.app.activitythread.handlelaunchactivity(android.app.activitythread$activityclientrecord, android.content.intent, java.lang.string) (activitythread.java:2856) 2018-09-27 13:51:41.116 22090-22090/? i/zygote64: at void android.app.activitythread.-wrap11(android.app.activitythread, android.app.activitythread$activityclientrecord, android.content.intent, java.lang.string) (activitythread.java:-1) 2018-09-27 13:51:41.116 22090-22090/? i/zygote64: at void android.app.activitythread$h.handlemessage(android.os.message) (activitythread.java:1589) 2018-09-27 13:51:41.116 22090-22090/? i/zygote64: at void android.os.handler.dispatchmessage(android.os.message) (handler.java:106) 2018-09-27 13:51:41.116 22090-22090/? i/zygote64: at void android.os.looper.loop() (looper.java:164) 2018-09-27 13:51:41.116 22090-22090/? i/zygote64: at void android.app.activitythread.main(java.lang.string[]) (activitythread.java:6494) 2018-09-27 13:51:41.116 22090-22090/? i/zygote64: at java.lang.object java.lang.reflect.method.invoke(java.lang.object, java.lang.object[]) (method.java:-2) 2018-09-27 13:51:41.116 22090-22090/? i/zygote64: at void com.android.internal.os.runtimeinit$methodandargscaller.run() (runtimeinit.java:438) 2018-09-27 13:51:41.116 22090-22090/? i/zygote64: at void com.android.internal.os.zygoteinit.main(java.lang.string[]) (zygoteinit.java:807) 2018-09-27 13:51:41.116 22090-22090/? i/zygote64: caused by: java.lang.classnotfoundexception: didn't find class "android.view.view$onunhandledkeyeventlistener" on path: dexpathlist[[zip file "/data/app/com.manacle.secondmanacle-6ra5peomwc4hh30itlexcg==/base.apk"],nativelibrarydirectories=[/data/app/com.manacle.secondmanacle-6ra5peomwc4hh30itlexcg==/lib/arm64, /system/lib64, /vendor/lib64]] android studioによって生成されたテンプレートアプリは変更していません。テンプレート生成アプリが正常に起動しないのはなぜですか?androidxへの移行を試みましたが、問題はまったく同じままです。android studioが「クリーンな」テンプレートアプリケーションを生成できないのはなぜですか?私のgradleファイルはこれに似ています:-buildscript { repositories { google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.2.0' // note: do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { google() jcenter() } } task clean(type: delete) { delete rootproject.builddir } ====apply plugin: 'com.android.application' android { compilesdkversion 28 defaultconfig { applicationid "com.manacle.secondmanacle" minsdkversion 21 targetsdkversion 28 versioncode 1 versionname "1.0" testinstrumentationrunner "androidx.test.runner.androidjunitrunner" } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { implementation filetree(dir: 'libs', include: ['*.jar']) implementation 'androidx.appcompat:appcompat:1.0.0' implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha2' testimplementation 'junit:junit:4.12' androidtestimplementation 'androidx.test:runner:1.1.0-alpha4' androidtestimplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4' }
回答: build.gradleファイルの最後にこれを貼り付けることで、同様の問題を解決しましたconfigurations.all { resolutionstrategy.eachdependency { dependencyresolvedetails details -> def requested = details.requested if (requested.group == "com.android.support") { if (!requested.name.startswith("multidex")) { details.useversion "26.+" } } } } https://github.com/facebook/flipper/issues/146