amir_70
amir_70

Reputation: 930

app immediately crash when opening

i have some code and while trying to run the app open and immediately crashes . this is my logcat. i ran this my code on sony xperia L and samsung galaxy A9 and there was no problem but in my huawei ascend mate 7 this is the app will crash logcat :

    07-11 00:39:57.413 18225-18242/com.example.android.miwok E/HAL: load: id=gralloc != hmi->id=gralloc
07-11 00:39:57.488 18225-18225/com.example.android.miwok W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=arm --instruction-set-features=smp,div,atomic_ldrd_strd --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=cortex-a15 --instruction-set-features=default --dex-file=/data/app/com.example.android.miwok-1/split_lib_slice_4_apk.apk --oat-file=/data/dalvik-cache/arm/data@[email protected]@[email protected]) because non-0 exit status
07-11 00:39:57.551 18225-18225/com.example.android.miwok W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=arm --instruction-set-features=smp,div,atomic_ldrd_strd --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=cortex-a15 --instruction-set-features=default --dex-file=/data/app/com.example.android.miwok-1/split_lib_slice_5_apk.apk --oat-file=/data/dalvik-cache/arm/data@[email protected]@[email protected]) because non-0 exit status
07-11 00:39:57.617 18225-18225/com.example.android.miwok W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=arm --instruction-set-features=smp,div,atomic_ldrd_strd --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=cortex-a15 --instruction-set-features=default --dex-file=/data/app/com.example.android.miwok-1/split_lib_slice_7_apk.apk --oat-file=/data/dalvik-cache/arm/data@[email protected]@[email protected]) because non-0 exit status
07-11 00:39:57.625 18225-18225/com.example.android.miwok W/System: ClassLoader referenced unknown path: /data/app/com.example.android.miwok-1/lib/arm
07-11 00:39:57.635 18225-18225/com.example.android.miwok I/InstantRun: starting instant run server: is main process
07-11 00:39:57.721 18225-18225/com.example.android.miwok I/art: Rejecting re-init on previously-failed class java.lang.Class<com.example.android.miwok.MainActivity>
07-11 00:39:57.721 18225-18225/com.example.android.miwok D/AndroidRuntime: Shutting down VM
07-11 00:39:57.726 18225-18225/com.example.android.miwok E/AndroidRuntime: FATAL EXCEPTION: main
                                                                           Process: com.example.android.miwok, PID: 18225
                                                                           java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.android.miwok/com.example.android.miwok.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.example.android.miwok.MainActivity" on path: DexPathList[[zip file "/data/app/com.example.android.miwok-1/base.apk", zip file "/data/app/com.example.android.miwok-1/split_lib_slice_4_apk.apk", zip file "/data/app/com.example.android.miwok-1/split_lib_slice_5_apk.apk", zip file "/data/app/com.example.android.miwok-1/split_lib_slice_7_apk.apk"],nativeLibraryDirectories=[/data/app/com.example.android.miwok-1/lib/arm, /vendor/lib, /system/lib]]
                                                                               at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2352)
                                                                               at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2504)
                                                                               at android.app.ActivityThread.access$900(ActivityThread.java:165)
                                                                               at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1368)
                                                                               at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                               at android.os.Looper.loop(Looper.java:150)
                                                                               at android.app.ActivityThread.main(ActivityThread.java:5546)
                                                                               at java.lang.reflect.Method.invoke(Native Method)
                                                                               at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:792)
                                                                               at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:682)
                                                                            Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.android.miwok.MainActivity" on path: DexPathList[[zip file "/data/app/com.example.android.miwok-1/base.apk", zip file "/data/app/com.example.android.miwok-1/split_lib_slice_4_apk.apk", zip file "/data/app/com.example.android.miwok-1/split_lib_slice_5_apk.apk", zip file "/data/app/com.example.android.miwok-1/split_lib_slice_7_apk.apk"],nativeLibraryDirectories=[/data/app/com.example.android.miwok-1/lib/arm, /vendor/lib, /system/lib]]
                                                                               at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
                                                                               at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
                                                                               at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
                                                                               at android.app.Instrumentation.newActivity(Instrumentation.java:1070)
                                                                               at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2342)
                                                                               at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2504) 
                                                                               at android.app.ActivityThread.access$900(ActivityThread.java:165) 
                                                                               at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1368) 
                                                                               at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                               at android.os.Looper.loop(Looper.java:150) 
                                                                               at android.app.ActivityThread.main(ActivityThread.java:5546) 
                                                                               at java.lang.reflect.Method.invoke(Native Method) 
                                                                               at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:792) 
                                                                               at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:682) 
                                                                            Suppressed: java.lang.NoClassDefFoundError: com.example.android.miwok.MainActivity
                                                                               at dalvik.system.DexFile.defineClassNative(Native Method)
                                                                               at dalvik.system.DexFile.defineClass(DexFile.java:230)
                                                                               at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:223)
                                                                               at dalvik.system.DexPathList.findClass(DexPathList.java:343)
                                                                               at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:54)
                                                                                    ... 13 more
                                                                            Suppressed: java.lang.ClassNotFoundException: com.example.android.miwok.MainActivity
                                                                               at java.lang.Class.classForName(Native Method)
                                                                               at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
                                                                               at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
                                                                               at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
                                                                                    ... 12 more
                                                                            Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available

edit:

when i turn off instant run it will work again on even my huawei device . but with instant run problem remained .

Upvotes: 1

Views: 183

Answers (1)

user8209152
user8209152

Reputation:

If you have a class on the application level you should tell proguard to keep it public.

This is how I did it. I am currently using ADT20, I dont know if it is the same for older versions.

In file: proguard-project.txt append this line (MyAPP being the class)

-keep public class In file: project.properties uncomment this line

proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt More info here:http://developer.android.com/tools/help/proguard.html#configuring

Upvotes: 1

Related Questions