我有一个应用程序,除了在API 19下启动,我得到下面的堆栈跟踪。
我之前不得不添加到gradle的构建中:
defaultConfig {
multiDexEnabled true
来自另一个类似的question我也添加了依赖
depenencies {
...
compile 'com.android.support:multidex:1.0.1'
...
}
但是应用程序仍然在API19下开始崩溃。
有人可以帮忙吗?
02-21 16:07:05.043 3348-3348/? E/memtrack: Couldn't load memtrack module (No such file or directory) 02-21 16:07:05.043 3348-3348/? E/android.os.Debug: failed to load memtrack module: -2 02-21 16:07:19.723 3359-3359/? E/memtrack: Couldn't load memtrack module (No such file or directory) 02-21 16:07:19.723 3359-3359/? E/android.os.Debug: failed to load memtrack module: -2 02-21 16:07:19.923 2015-2015/com.google.android.gms E/dalvikvm: Dex cache directory isn't writable: /data/dalvik-cache 02-21 16:07:19.923 2015-2015/com.google.android.gms E/ChimeraModuleLdr: Initialization failed for module apk com.google.android.play.games
java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.chimera.GmsModuleInitializer" on path: DexPathList[[zip file "/system/app/PlayGames.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
at csg.loadClass(:com.google.android.gms@11947030:3)
at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
at com.google.android.gms.chimera.container.GmsModuleApi.onApkLoaded(:com.google.android.gms@11947030:1)
at csm.a(:com.google.android.gms@11947030:88)
at csm.a(:com.google.android.gms@11947030:35)
at csm.a(:com.google.android.gms@11947030:118)
答案 0 :(得分:0)
根据docs,您是否让应用程序扩展MultiDexApplication或在应用程序类中初始化multidex? 像这样:
要么这样做:
创建应用程序类范围MultiDexApplication
public class MyApplication extends MultiDexApplication { ... }
更改清单如下:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myapp">
<application
android:name="android.support.multidex.MultiDexApplication" >
...
</application>
</manifest>
或者
public class MyApplication extends SomeOtherApplication {
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(context);
Multidex.install(this);
}
}