java.lang.ClassNotFoundException 在 API 级别 19
java.lang.ClassNotFoundException under API Level 19
我有一个应用程序,除了在 API 19 下启动,我得到下面的堆栈跟踪。
我之前必须添加到 gradle 的构建中:
defaultConfig {
multiDexEnabled true
来自另一个类似的 我还添加了依赖项
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)
根据 docs,您是否让您的应用程序扩展了 MultiDexApplication 或在您的应用程序中初始化了 multidex class?
像这样:
要么这样做:
制作应用class extent 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);
}
}
我有一个应用程序,除了在 API 19 下启动,我得到下面的堆栈跟踪。
我之前必须添加到 gradle 的构建中:
defaultConfig {
multiDexEnabled true
来自另一个类似的
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)
根据 docs,您是否让您的应用程序扩展了 MultiDexApplication 或在您的应用程序中初始化了 multidex class? 像这样:
要么这样做:
制作应用class extent 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);
}
}