我正在按照https://developer.android.com/guide/app-bundle/build上的说明构建新的 android app-bundle,但是从 Play 商店安装时出现错误。
2018-06-04 11:06:09.397 10595-10595/? E/AndroidRuntime: Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: io.org.app.ui.loading.LoadingFragment
at androidx.navigation.fragment.b$a.a(FragmentNavigator.java:219)
at androidx.navigation.fragment.b$a.a(FragmentNavigator.java:202)
at androidx.navigation.k.a(NavInflater.java:140)
at androidx.navigation.k.a(NavInflater.java:169)
at androidx.navigation.k.a(NavInflater.java:120)
... 36 more
Caused by: java.lang.ClassNotFoundException: io.org.app.ui.loading.LoadingFragment
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:453)
at androidx.navigation.fragment.b$a.a(FragmentNavigator.java:215)
... 40 more
Caused by: java.lang.ClassNotFoundException: Didn't find class "io.org.app.ui.loading.LoadingFragment" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/io.org.app-2KUWPMF_QJ31_iG8kGu1rA==/base.apk", zip file "/data/app/io.org.app-2KUWPMF_QJ31_iG8kGu1rA==/split_config.arm64_v8a.apk", zip file "/data/app/io.org.app-2KUWPMF_QJ31_iG8kGu1rA==/split_config.en.apk", zip file "/data/app/io.prg.app-2KUWPMF_QJ31_iG8kGu1rA==/split_config.iw.apk", zip file "/data/app/io.org.app-2KUWPMF_QJ31_iG8kGu1rA==/split_config.xxhdpi.apk"],nativeLibraryDirectories=[/data/app/io.org.app-2KUWPMF_QJ31_iG8kGu1rA==/lib/arm64, /data/app/io.org.app-2KUWPMF_QJ31_iG8kGu1rA==/base.apk!/lib/arm64-v8a, /data/app/io.org.app-2KUWPMF_QJ31_iG8kGu1rA==/split_config.arm64_v8a.apk!/lib/arm64-v8a, /data/app/io.org.app-2KUWPMF_QJ31_iG8kGu1rA==/split_config.en.apk!/lib/arm64-v8a, /data/app/io.org.app-2KUWPMF_QJ31_iG8kGu1rA==/split_config.iw.apk!/lib/arm64-v8a, /data/app/io.org.app-2KUWPMF_QJ31_iG8kGu1rA==/split_config.xxhdpi.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 43 more
Suppressed: java.io.IOException: No original dex files found for dex location /data/app/io.org.app-2KUWPMF_QJ31_iG8kGu1rA==/split_config.arm64_v8a.apk
at dalvik.system.DexFile.openDexFileNative(Native Method)
at dalvik.system.DexFile.openDexFile(DexFile.java:354)
at dalvik.system.DexFile.<init>(DexFile.java:101)
at dalvik.system.DexFile.<init>(DexFile.java:75)
at dalvik.system.DexPathList.loadDexFile(DexPathList.java:374)
at dalvik.system.DexPathList.makeDexElements(DexPathList.java:337)
at dalvik.system.DexPathList.<init>(DexPathList.java:157)
at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:65)
at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:64)
at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:73)
at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:88)
at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:72)
at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:38)
at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:715)
at android.app.LoadedApk.getClassLoader(LoadedApk.java:750)
at android.app.LoadedApk.getResources(LoadedApk.java:972)
at android.app.ContextImpl.createAppContext(ContextImpl.java:2329)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5743)
at android.app.ActivityThread.access$1000(ActivityThread.java:198)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1637)
... 6 more
Suppressed: java.io.IOException: No original dex files found for dex location /data/app/io.org.app-2KUWPMF_QJ31_iG8kGu1rA==/split_config.en.apk
at dalvik.system.DexFile.openDexFileNative(Native Method)
at dalvik.system.DexFile.openDexFile(DexFile.java:354)
at dalvik.system.DexFile.<init>(DexFile.java:101)
at dalvik.system.DexFile.<init>(DexFile.java:75)
at dalvik.system.DexPathList.loadDexFile(DexPathList.java:374)
我在构建中包含以下内容:
android {
buildTypes {
release {
multiDexKeepProguard file ('multidex-keep.pro')
}
}
}
multidex-keep.pro:
-keep class io.org.app.ui.main.** { *; }
-keep class io.org.app.ui.loading.** { *; }