Android 更新后,构造函数被错误地标记为 11

Constructor flagged inappropriately 11 after Android Update

自从我刷到 Android 7.1.2 我自己的应用程序崩溃并出现以下错误:


art             Failure to verify dex file '/data/app/com.lolxdfly.flyengine-2/base.apk': Constructor 33473(Lcom/lolxdfly/flyengine/GLUtils/WndDebug;.<init>) flagged inappropriately 11
System          ClassLoader referenced unknown path: /data/app/com.lolxdfly.flyengine-2/lib/arm
AndroidRuntime  Shutting down VM
AndroidRuntime  FATAL EXCEPTION: main
AndroidRuntime  Process: com.lolxdfly.flyengine, PID: 25880
AndroidRuntime  java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.lolxdfly.flyengine/com.lolxdfly.flyengine.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.lolxdfly.flyengine.MainActivity" on path: DexPathList[[zip file "/data/app/com.lolxdfly.flyengine-2/base.apk"],nativeLibraryDirectories=[/data/app/com.lolxdfly.flyengine-2/lib/arm, /system/lib, /vendor/lib]]
AndroidRuntime  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2583)
AndroidRuntime  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2742)
AndroidRuntime  at android.app.ActivityThread.-wrap12(ActivityThread.java)
AndroidRuntime  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1489)
AndroidRuntime  at android.os.Handler.dispatchMessage(Handler.java:102)
AndroidRuntime  at android.os.Looper.loop(Looper.java:154)
AndroidRuntime  at android.app.ActivityThread.main(ActivityThread.java:6178)
AndroidRuntime  at java.lang.reflect.Method.invoke(Native Method)
AndroidRuntime  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:891)
AndroidRuntime  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:781)
AndroidRuntime  Caused by: java.lang.ClassNotFoundException: Didn't find class "com.lolxdfly.flyengine.MainActivity" on path: DexPathList[[zip file "/data/app/com.lolxdfly.flyengine-2/base.apk"],nativeLibraryDirectories=[/data/app/com.lolxdfly.flyengine-2/lib/arm, /system/lib, /vendor/lib]]
AndroidRuntime  at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
AndroidRuntime  at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
AndroidRuntime  at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
AndroidRuntime  at android.app.Instrumentation.newActivity(Instrumentation.java:1079)
AndroidRuntime  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2573)
AndroidRuntime  ... 9 more
AndroidRuntime  Suppressed: java.io.IOException: Failed to open dex files from /data/app/com.lolxdfly.flyengine-2/base.apk because: Failure to verify dex file '/data/app/com.lolxdfly.flyengine-2/base.apk': Constructor 33473(Lcom/lolxdfly/flyengine/GLUtils/WndDebug;.<init>) flagged inappropriately 11
AndroidRuntime  at dalvik.system.DexFile.openDexFileNative(Native Method)
AndroidRuntime  at dalvik.system.DexFile.openDexFile(DexFile.java:367)
AndroidRuntime  at dalvik.system.DexFile.<init>(DexFile.java:112)
AndroidRuntime  at dalvik.system.DexFile.<init>(DexFile.java:77)
AndroidRuntime  at dalvik.system.DexPathList.loadDexFile(DexPathList.java:359)
AndroidRuntime  at dalvik.system.DexPathList.makeElements(DexPathList.java:323)
AndroidRuntime  at dalvik.system.DexPathList.makeDexElements(DexPathList.java:263)
AndroidRuntime  at dalvik.system.DexPathList.<init>(DexPathList.java:126)
AndroidRuntime  at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:48)
AndroidRuntime  at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:64)
AndroidRuntime  at com.android.internal.os.PathClassLoaderFactory.createClassLoader(PathClassLoaderFactory.java:43)
AndroidRuntime  at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:58)
AndroidRuntime  at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:520)
AndroidRuntime  at android.app.LoadedApk.getClassLoader(LoadedApk.java:553)
AndroidRuntime  at android.app.ActivityThread.getTopLevelResources(ActivityThread.java:1882)
AndroidRuntime  at android.app.LoadedApk.getResources(LoadedApk.java:766)
AndroidRuntime  at android.app.ContextImpl.<init>(ContextImpl.java:2038)
AndroidRuntime  at android.app.ContextImpl.createAppContext(ContextImpl.java:1983)
AndroidRuntime  at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5353)
AndroidRuntime  at android.app.ActivityThread.-wrap2(ActivityThread.java)
AndroidRuntime  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1557)
AndroidRuntime  ... 6 more

art             Failure to verify dex file '/data/app/com.lolxdfly.flyengine-2/base.apk': Constructor 33473(Lcom/lolxdfly/flyengine/GLUtils/WndDebug;.<init>) flagged inappropriately 11

此错误处的构造函数每次执行都会更改。


一切都是 运行 Android 6.0.1!

我的 MainActivity.java 位于 \com\lolxdfly\flyengine\MainActivity.java。 我已经考虑过旧的项目文件,但是创建一个新项目并从 git 克隆会导致同样的错误。一个干净的 hello world 运行没有问题,所以我只替换了资源文件和 AndroidManifest.xml,一切仍然有效。崩溃仅在我复制所有 .java 文件后发生。

只是一些附加信息: 我的应用程序使用 OpenGL ES 2.0、Google 广告、Google 游戏 API 和 Google 许可 API.

我已经将一些 类 的构造函数标记为 'final'。 这似乎成为 Android 7 中的一个问题,所以我将从构造函数中删除所有最终标志(无论如何最终都不影响构造函数..)。