错误代码段:
Fatal Exception: java.lang.NoClassDefFoundError: android/graphics/drawable/Icon
at java.lang.Class.getDeclaredMethods(Class.java)
at java.lang.Class.getDeclaredMethods(Class.java:656)
at android.view.ViewDebug.getExportedPropertyMethods(ViewDebug.java:960)
at android.view.ViewDebug.exportMethods(ViewDebug.java:1047)
at android.view.ViewDebug.dumpViewProperties(ViewDebug.java:997)
at android.view.ViewDebug.dumpViewProperties(ViewDebug.java:983)
at android.view.ViewDebug.dumpView(ViewDebug.java:900)
at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:870)
at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:867)
at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:867)
at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:867)
at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:867)
at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:867)
at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:867)
at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:867)
at android.view.ViewDebug.dump(ViewDebug.java:793)
at android.view.ViewDebug.dispatchCommand(ViewDebug.java:416)
at android.view.ViewRootImpl$W.executeCommand(ViewRootImpl.java:6258)
at android.view.IWindow$Stub.onTransact(IWindow.java:65)
at android.os.Binder.execTransact(Binder.java:404)
at dalvik.system.NativeStart.run(NativeStart.java)
我从来没有在我的代码中使用android.graphics.drawable.Icon,所有的用法都来自android.support.v4.graphics.drawable.IconCompat我也从不在我的代码中使用该类...我的支持库是 version 26.0.0, my minSdkVersion is 15 targetSdkVersion is 26. 然而这个问题已在支持库27.0.0中解决:
Android Gradle插件3.x:
implementation 'com.android.support:appcompat-v7:27.0.1'
implementation 'com.android.support:support-v4:27.0.1'
Android Gradle插件2.x:
compile 'com.android.support:appcompat-v7:27.0.1'
compile 'com.android.support:support-v4:27.0.1'