javaandroidclassnotfoundexceptionmain-activity

Constructor flagged inappropriately 11 after Android Update


Since I flashed to Android 7.1.2 my own App crashes with this errors:


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

The Constructor at this error changes every execution.


Everything was running at Android 6.0.1!

My MainActivity.java is located at \com\lolxdfly\flyengine\MainActivity.java. I alrady thought about old project files, but creating a new project and clone from git results in the same error. A clean hello world runs without problems, so I only replaced the resource files and AndroidManifest.xml and everything still worked. The crash only occurs after I copied all the .java files.

Just some additional info: My App uses OpenGL ES 2.0, Google Ads, Google Games API and Google Licensing API.


Solution

  • I had flagged the constructor of some classes as 'final'. It seems like this becomes a problem in Android 7, so I will remove every final flags from constructors (final does not effect the constroctor anyway..).