导入aar后的NoClassDefFoundError

时间:2016-04-16 13:54:27

标签: android

根据文档,我成功地使用了https://github.com/lzyzsd/CircleProgress

compile 'com.github.lzyzsd:circleprogress:1.1.0@aar'

<com.github.lzyzsd.circleprogress.DonutProgress
    xmlns:custom="http://schemas.android.com/apk/res-auto"
    custom:donut_finished_stroke_width="4dp"
    custom:donut_unfinished_stroke_width="3dp"
    custom:donut_progress="40"/>

但是我错过了添加到Git但尚未发布新版本的属性donut_circle_starting_degree。所以我下载了这个库并在本地打包。我使用Android studio功能从aar导入模块。

我将此模块作为编译依赖项添加到原始模块中。编译没问题,但在运行时失败了:

Caused by: java.lang.ClassNotFoundException: Didn't find class "com.github.lzyzsd.circleprogress.DonutProgress" on path: DexPathList[[zip file "/data/app/lelisoft.com.lelimath-1/base.apk"],nativeLibraryDirectories=[/data/app/lelisoft.com.lelimath-1/lib/arm64, /vendor/lib64, /system/lib64]]
   at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
   at android.view.LayoutInflater.createView(LayoutInflater.java:583)
Suppressed: java.lang.ClassNotFoundException: com.github.lzyzsd.circleprogress.DonutProgress
   at java.lang.Class.classForName(Native Method)
   at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
   at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
        ... 28 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available

我没有运气就测试了其他导入选项。这是类似的问题https://stackoverflow.com/a/32598823/1639556

1 个答案:

答案 0 :(得分:3)

尝试清理库项目和导入它的项目