Android Studio - 升级后无法解析L类

时间:2014-10-30 12:22:11

标签: android android-studio

我最近在Android Studio中将我的工具和build.gradle升级到了第21版。

我的apk现在在加载时崩溃,我收到以下错误:

 Unable to resolve superclass of Lcom/mypackage/MyClass; 
 Link of class 'Lcom/mypackage/MyClass

是否有人遇到类似问题?

我尝试过以下但没有成功:

清洁项目    重启android studio    重新导入项目

更多日志详情:

java.lang.RuntimeException: Unable to instantiate application com.mypackage.MyClass:    
java.lang.ClassNotFoundException: Didn't find class "com.mypackage.MyClass" on path: 
DexPathList[[zip file "/data/app/com.mypackage-1.apk"],nativeLibraryDirectories=[/data/app-
lib/com.mypackage-1, /vendor/lib, /system/lib]]
        at android.app.LoadedApk.makeApplication(LoadedApk.java:507)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4301)
        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.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:515)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
        at dalvik.system.NativeStart.main(Native Method)

Caused by: java.lang.ClassNotFoundException: Didn't find class "com.mypackage.MyClass" on path: 
DexPathList[[zip file "/data/app/com.mypackage-1.apk"],nativeLibraryDirectories=[/data/app-
lib/com.mypackage-1, /vendor/lib, /system/lib]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
        at android.app.Instrumentation.newApplication(Instrumentation.java:975)
        at android.app.LoadedApk.makeApplication(LoadedApk.java:502)

1 个答案:

答案 0 :(得分:0)

我后来发现这是一个与多德兴相关的问题。

我需要运行一个脚本来为我的main-dex-list

生成文件的名称

下面的博客文章详细介绍了这一点:http://blog.osom.info/2014/10/generating-main-dex-list-file.html