我的应用程序在Dalvik上运行得很好,但是当我尝试在ART上运行它时,我得到一个NoClassDefFoundError。我使用的是Android Studio 0.6.1
这是堆栈跟踪:
06-20 16:13:05.376 16008-16008/com.myapp.android I/art﹕ Rejecting re-init on
previously-failed class java.lang.Class<net.sf.cglib.transform.AbstractProcessTask>
06-20 16:13:05.376 16008-16008/com.myapp.android D/AndroidRuntime﹕ Shutting down VM
06-20 16:13:05.376 16008-16008/com.myapp.android E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.myapp.android, PID: 16008
java.lang.NoClassDefFoundError: net.sf.cglib.transform.AbstractProcessTask
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:305)
at com.droidbase.Loader.getClassForFile(Loader.java:155)
at com.droidbase.Loader.getClassesForFiles(Loader.java:145)
at com.droidbase.Loader.getAllClasses(Loader.java:64)
at com.droidbase.Loader.getClassesExtending(Loader.java:54)
at com.droidbase.DroidBase.getModels(DroidBase.java:87)
at com.droidbase.DroidBase.loadModels(DroidBase.java:97)
at com.droidbase.DroidBase.setup(DroidBase.java:66)
at com.droidbase.DroidBase.initialize(DroidBase.java:23)
at com.droidbase.DroidBase.setup(DroidBase.java:27)
at com.myapp.android.MyApplication.onCreate(MyApplication.java:22)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1007)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4328)
at android.app.ActivityThread.access$1500(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5001)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
答案 0 :(得分:2)
事实证明我在Gradle文件中缺少依赖项。在我的情况下,我需要将行compile 'org.apache.ant:ant:1.9.4'
添加到我的依赖项中。为什么这对Dalvik有效,但对ART不起作用。