应用程序在打开时立即崩溃

时间:2017-07-10 20:20:50

标签: java android

我有一些代码,同时尝试打开应用程序并立即崩溃 。这是我的logcat。我在sony xperia L和三星Galaxy A9上运行了我的代码并且没有问题,但是在我的huawei登高伙伴7这是应用程序将崩溃 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@app@com.example.android.miwok-1@split_lib_slice_4_apk.apk@classes.dex) 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@app@com.example.android.miwok-1@split_lib_slice_5_apk.apk@classes.dex) 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@app@com.example.android.miwok-1@split_lib_slice_7_apk.apk@classes.dex) 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

编辑:

当我关闭即时运行时,它甚至会在我的华为设备上再次运行。但仍然存在即时运行问题。

1 个答案:

答案 0 :(得分:1)

如果您在应用程序级别上有课程,则应告知proguard将其公开。

这就是我做的。我目前正在使用ADT20,我不知道旧版本是否相同。

在文件中:proguard-project.txt追加此行(MyAPP为类)

- 保持公共课 在文件中:project.properties取消注释此行

proguard.config = $ {sdk.dir} /tools/proguard/proguard-android.txt:proguard-project.txt 更多信息:http://developer.android.com/tools/help/proguard.html#configuring