Android 4.4中添加Ion库后的ClassNotFoundException(19)

时间:2016-12-08 15:58:42

标签: android ion

将Ion库添加到我的项目后,我无法在Android 4.4中启动我的应用程序,一切都更好。

E/AndroidRuntime: FATAL EXCEPTION: main
              Process: com.swe.gruppe4.mockup2, PID: 3281
              java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.swe.gruppe4.mockup2/com.swe.gruppe4.mockup2.LoginActivity}: java.lang.ClassNotFoundException: Didn't find class "com.swe.gruppe4.mockup2.LoginActivity" on path: DexPathList[[zip file "/data/app/com.swe.gruppe4.mockup2-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.swe.gruppe4.mockup2-2, /vendor/lib, /system/lib]]
                  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2121)
                  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
                  at android.app.ActivityThread.access$800(ActivityThread.java:135)
                  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
                  at android.os.Handler.dispatchMessage(Handler.java:102)
                  at android.os.Looper.loop(Looper.java:136)
                  at android.app.ActivityThread.main(ActivityThread.java:5017)
                  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:779)
                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
                  at dalvik.system.NativeStart.main(Native Method)
               Caused by: java.lang.ClassNotFoundException: Didn't find class "com.swe.gruppe4.mockup2.LoginActivity" on path: DexPathList[[zip file "/data/app/com.swe.gruppe4.mockup2-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.swe.gruppe4.mockup2-2, /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.newActivity(Instrumentation.java:1061)
                  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2112)
                  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) 
                  at android.app.ActivityThread.access$800(ActivityThread.java:135) 
                  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 
                  at android.os.Handler.dispatchMessage(Handler.java:102) 
                  at android.os.Looper.loop(Looper.java:136) 
                  at android.app.ActivityThread.main(ActivityThread.java:5017) 
                  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:779) 
                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 
                  at dalvik.system.NativeStart.main(Native Method) 
Application terminated.

我通过应用程序的build.gradle添加了Ion,正如github compile 'com.koushikdutta.ion:ion:2.+'所述。

如前所述,在较高的Android版本上,它可以正常工作。 只需添加Ion

,它在完全干净的项目中也能正常工作

1 个答案:

答案 0 :(得分:0)

我现在自己解决了这个问题。 我创建了一个具有相同包名称的新项目,并将app文件夹完全复制到新项目中,它在那里工作正常。怪异!