cn1*_*23h 94 android noclassdeffounderror android-support-library
到目前为止,我只为一位使用root手机的用户(SM-G900R7 Android 4.4.2)收到此错误.错误是这样的:
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)
Run Code Online (Sandbox Code Playgroud)
我从不在我的代码中使用android.graphics.drawable.Icon,所有用法都是来自android.support.v4.graphics.drawable.IconCompat我也从不在我的代码中使用该类...
顺便说一句,我的支持库是 version 26.0.0, my minSdkVersion is 15 targetSdkVersion is 26.
谢谢
Eug*_*nec 40
该问题已在支持库27.0.0中修复.如果您更新,请不要忘记更改compileSdkVersion 27.
当扩展的类View定义返回或获取不在类路径上的类型参数的方法时,Android 4.4的三星设备会像这样崩溃.
从支持库版本25.4.0开始AppCompatImageView并AppCompatImageButton错误地覆盖setImageIcon(Icon)方法.由于IconAPI在API 23中引入,因此应用程序在使用API 19的三星设备上崩溃.
当你试图覆盖时会发生类似的事情View.onApplyWindowInsets(WindowInsets).
在以官方方式修复此问题之前,如果您遇到旧版本的支持库,我会修改一个版本,删除appcompat-v7所有setImageIcon方法痕迹.这意味着它不会在搭载Android 4.4的三星上崩溃.
把它放在应用程序build.gradle的底部:
repositories {
maven { url "https://dl.bintray.com/consp1racy/maven" }
}
configurations.all {
resolutionStrategy.eachDependency { details ->
def requested = details.requested
if (requested.group == 'com.android.support' && requested.name == 'appcompat-v7') {
details.useTarget 'net.xpece.android:support-appcompat-v7-fixed:26.1.0-1'
}
}
}
Run Code Online (Sandbox Code Playgroud)
此代码将appcompat-v7用所描述的修改工件替换依赖项.
目前唯一支持的修补程序版本是26.1.0.
警告:在复制粘贴之前了解代码,并在从未知来源获取代码时始终保持谨慎!
Pau*_*sma 14
Android Gradle插件3.x:
implementation 'com.android.support:appcompat-v7:27.0.0'
implementation 'com.android.support:support-v4:27.0.0'
Run Code Online (Sandbox Code Playgroud)
Android Gradle插件2.x:
compile 'com.android.support:appcompat-v7:27.0.0'
compile 'com.android.support:support-v4:27.0.0'
Run Code Online (Sandbox Code Playgroud)
请注意,您还需要针对SDK级别27进行编译.
Dus*_*Dus -1
有 2 个选项:
| 归档时间: |
|
| 查看次数: |
9722 次 |
| 最近记录: |