无法验证dex文件乱序的注解_元素名_idx

时间:2018-08-21 12:03:25

标签: android gradle mobile build.gradle dex

我需要您的帮助。从更新我的gradle时出现运行时错误:

  • 实施'com.google.android.gms:play-services-auth:15.0.1'
  • 实现'com.facebook.android:facebook-android-sdk:4.27.0'

至:

  • 实施'com.google.android.gms:play-services-auth:15.0.1'
  • 实现'com.facebook.android:facebook-android-sdk:4.27.0'
  • 实施'com.google.android.gms:play-services-ads:15.0.1'
  • 实施'com.facebook.android:audience-network-sdk:4.27.0'

错误日志: E / AndroidRuntime:致命异常:main                                                  进程:id.android.steven.dev,PID:5539                                                  java.lang.RuntimeException:无法实例化应用程序id.android.steven.MyApplication:java.lang.ClassNotFoundException:在路径:DexPathList [[zip file“中找不到类“ id.android.steven.MyApplication” /data/app/id.android.steven.dev-2/base.apk"],nativeLibraryDirectories=[/data/app/id.android.teven.dev-2/lib/arm,/ data / app / id.android.steven.dev-2 / base.apk!/ lib / armeabi-v7a,/ system / lib,/ vendor / lib]]                                                      在android.app.LoadedApk.makeApplication(LoadedApk.java:846)                                                      在android.app.ActivityThread.handleBindApplication(ActivityThread.java:5944)                                                      在android.app.ActivityThread.-wrap3(ActivityThread.java)                                                      在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1710)                                                      在android.os.Handler.dispatchMessage(Handler.java:102)                                                      在android.os.Looper.loop(Looper.java:154)                                                      在android.app.ActivityThread.main(ActivityThread.java:6776)                                                      在java.lang.reflect.Method.invoke(本机方法)                                                      在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:1496)                                                      在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1386)                                                   由以下原因引起: java.lang.ClassNotFoundException:在路径:DexPathList上找不到类“ id.android.steven.MyApplication” [[zip文件“ /data/app/id.android.steven。 dev-2 / base.apk“],nativeLibraryDirectories = [/ data / app / id.android.steven.dev-2 / lib / arm,/ data / app / id.android.steven.dev-2 / base.apk !/ lib / armeabi-v7a,/ system / lib,/ vendor / lib]]                                                      在dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)                                                      在java.lang.ClassLoader.loadClass(ClassLoader.java:380)                                                      在java.lang.ClassLoader.loadClass(ClassLoader.java:312)                                                      在android.app.Instrumentation.newApplication(Instrumentation.java:1000)                                                      在android.app.LoadedApk.makeApplication(LoadedApk.java:835)                                                      在android.app.ActivityThread.handleBindApplication(ActivityThread.java:5944)                                                      在android.app.ActivityThread.-wrap3(ActivityThread.java)                                                      在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1710)                                                      在android.os.Handler.dispatchMessage(Handler.java:102)                                                      在android.os.Looper.loop(Looper.java:154)                                                      在android.app.ActivityThread.main(ActivityThread.java:6776)                                                      在java.lang.reflect.Method.invoke(本机方法)                                                      在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:1496)                                                      在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1386)                                                     禁止:java.io.IOException:无法从/data/app/id.android.steven.dev-2/base.apk打开dex文件,因为:无法验证dex文件'/ data / app / id。 android.steven.dev-2 / base.apk':乱序的注解元素名称idx:681e,然后是681e                                                      在dalvik.system.DexFile.openDexFileNative(本机方法)                                                      在dalvik.system.DexFile.openDexFile(DexFile.java:373)                                                      在dalvik.system.DexFile。(DexFile.java:113)                                                      在dalvik.system.DexFile。(DexFile.java:78)                                                      在dalvik.system.DexPathList.loadDexFile(DexPathList.java:359)                                                      在dalvik.system.DexPathList.makeElements(DexPathList.java:323)                                                      在dalvik.system.DexPathList.makeDexElements(DexPathList.java:263)                                                      在dalvik.system.DexPathList。(DexPathList.java:126)                                                      在dalvik.system.BaseDexClassLoader。(BaseDexClassLoader.java:48)                                                      在dalvik.system.PathClassLoader。(PathClassLoader.java:64)                                                      在com.android.internal.os.PathClassLoaderFactory.createClassLoader(PathClassLoaderFactory.java:43)                                                      在android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:58)                                                      在android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:535)                                                      在android.app.LoadedApk.getClassLoader(LoadedApk.java:568)                                                      在android.app.ActivityThread.getTopLevelResources(ActivityThread.java:2053)                                                      在android.app.LoadedApk.getResources(LoadedApk.java:787)                                                      在android.app.ContextImpl。(ContextImpl.java:2266)                                                      在android.app.ContextImpl.createAppContext(ContextImpl.java:2210)                                                      在android.app.ContextImpl.createAppContext(ContextImpl.java:2196)                                                      在android.app.ActivityThread.handleBindApplication(ActivityThread.java:5861)                                                             ...另外8个

预先感谢:)

1 个答案:

答案 0 :(得分:1)

只需检查应用程序gradle中是否有-overloadaggressively,此方法就会强制重载所有方法。如果您使用-overloadaggressively,只需禁用它并使用另一种方法即可。

请参阅this链接。