logcat部分日志如下:
E AndroidRuntime: FATAL EXCEPTION: main
10-21 09:40:58.322 2621 2621 E AndroidRuntime: Process: com.android.rk, PID: 2621
10-21 09:40:58.322 2621 2621 E AndroidRuntime: java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.android.rk/com.android.rk.RockExplorer}: java.lang.ClassNotFoundException: Didn't find class "com.android.rk.RockExplorer" on path: DexPathList[[zip file "/system/app/RkExplorer/RkExplorer.apk"],nativeLibraryDirectories=[/system/app/RkExplorer/lib/arm64, /system/fake-libs, /system/app/RkExplorer/RkExplorer.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib, /system/lib, /vendor/lib]]
10-21 09:40:58.322 2621 2621 E AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2573)
10-21 09:40:58.322 2621 2621 E AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2732)
10-21 09:40:58.322 2621 2621 E AndroidRuntime: at android.app.ActivityThread.-wrap12(ActivityThread.java)
10-21 09:40:58.322 2621 2621 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1483)
10-21 09:40:58.322 2621 2621 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102)
10-21 09:40:58.322 2621 2621 E AndroidRuntime: at android.os.Looper.loop(Looper.java:154)
10-21 09:40:58.322 2621 2621 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:6141)
10-21 09:40:58.322 2621 2621 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
10-21 09:40:58.322 2621 2621 E AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:912)
10-21 09:40:58.322 2621 2621 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:802)
10-21 09:40:58.322 2621 2621 E AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "com.android.rk.RockExplorer" on path: DexPathList[[zip file "/system/app/RkExplorer/RkExplorer.apk"],nativeLibraryDirectories=[/system/app/RkExplorer/lib/arm64, /system/fake-libs, /system/app/RkExplorer/RkExplorer.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib, /system/lib, /vendor/lib]]
10-21 09:40:58.322 2621 2621 E AndroidRuntime: at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
10-21 09:40:58.322 2621 2621 E AndroidRuntime: at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
10-21 09:40:58.322 2621 2621 E AndroidRuntime: at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
10-21 09:40:58.322 2621 2621 E AndroidRuntime: at android.app.Instrumentation.newActivity(Instrumentation.java:1078)
10-21 09:40:58.322 2621 2621 E AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2563)
10-21 09:40:58.322 2621 2621 E AndroidRuntime: ... 9 more
10-21 09:40:58.322 2621 2621 E AndroidRuntime: Suppressed: java.io.IOException: No original dex files found for dex location /system/app/RkExplorer/RkExplorer.apk
10-21 09:40:58.322 2621 2621 E AndroidRuntime: at dalvik.system.DexFile.openDexFileNative(Native Method)
10-21 09:40:58.322 2621 2621 E AndroidRuntime: at dalvik.system.DexFile.openDexFile(DexFile.java:367)
10-21 09:40:58.322 2621 2621 E AndroidRuntime: at dalvik.system.DexFile.<init>(DexFile.java:112)
10-21 09:40:58.322 2621 2621 E AndroidRuntime: at dalvik.system.DexFile.<init>(DexFile.java:77)
10-21 09:40:58.322 2621 2621 E AndroidRuntime: at dalvik.system.DexPathList.loadDexFile(DexPathList.java:359)
10-21 09:40:58.322 2621 2621 E AndroidRuntime: at dalvik.system.DexPathList.makeElements(DexPathList.java:323)
10-21 09:40:58.322 2621 2621 E AndroidRuntime: at dalvik.system.DexPathList.makeDexElements(DexPathList.java:263)
10-21 09:40:58.322 2621 2621 E AndroidRuntime: at dalvik.system.DexPathList.<init>(DexPathList.java:126)
10-21 09:40:58.322 2621 2621 E AndroidRuntime: at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:48)
10-21 09:40:58.322 2621 2621 E AndroidRuntime: at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:64)
10-21 09:40:58.322 2621 2621 E AndroidRuntime: at com.android.internal.os.PathClassLoaderFactory.createClassLoader(PathClassLoaderFactory.java:43)
10-21 09:40:58.322 2621 2621 E AndroidRuntime: at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:58)
10-21 09:40:58.322 2621 2621 E AndroidRuntime: at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:520)
10-21 09:40:58.322 2621 2621 E AndroidRuntime: at android.app.LoadedApk.getClassLoader(LoadedApk.java:553)
10-21 09:40:58.322 2621 2621 E AndroidRuntime: at android.app.ActivityThread.getTopLevelResources(ActivityThread.java:1872)
10-21 09:40:58.322 2621 2621 E AndroidRuntime: at android.app.LoadedApk.getResources(LoadedApk.java:766)
10-21 09:40:58.322 2621 2621 E AndroidRuntime: at android.app.ContextImpl.<init>(ContextImpl.java:2038)
10-21 09:40:58.322 2621 2621 E AndroidRuntime: at android.app.ContextImpl.createAppContext(ContextImpl.java:1983)
10-21 09:40:58.322 2621 2621 E AndroidRuntime: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5316)
10-21 09:40:58.322 2621 2621 E AndroidRuntime: at android.app.ActivityThread.-wrap2(ActivityThread.java)
10-21 09:40:58.322 2621 2621 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1551)
10-21 09:40:58.322 2621 2621 E AndroidRuntime: ... 6 more
解决方案:
1,针对单个app,修改Android.mk文件中的如下内容:
--- a/Android.mk +++ b/Android.mk @@ -20,6 +20,7 @@ LOCAL_MODULE_TAGS := optional LOCAL_SRC_FILES := $(call all-java-files-under, src) LOCAL_JAVA_LIBRARIES := bouncycastle conscrypt +LOCAL_DEX_PREOPT := false LOCAL_PACKAGE_NAME := KeyChain LOCAL_CERTIFICATE := platform
2,针对全部app,修改device下配置文件:
diff --git a/rk3399_all/BoardConfig.mk b/rk3399_all/BoardConfig.mk index 813afc4..adf8a11 100755 --- a/rk3399_all/BoardConfig.mk +++ b/rk3399_all/BoardConfig.mk @@ -7,7 +7,7 @@ BOARD_SENSOR_MPU_VR := false BOARD_SENSOR_COMPASS_AK8963-64 := true -WITH_DEXPREOPT := true +WITH_DEXPREOPT := false TARGET_BOARD_PLATFORM_PRODUCT := tablet
修改这里后最好clean后再编译以免没有生效。