java.lang.ClassNotFoundException : dalvik. 系统.BaseDexClassLoader.findClass

标签 java android classnotfoundexception android-multidex

我的 Google Play 开发者控制台不断收到此错误报告。看起来像 MultiDex 错误。

java.lang.RuntimeException: 
  at android.app.LoadedApk.makeApplication(LoadedApk.java:516)
  at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4514)
  at android.app.ActivityThread.access$1500(ActivityThread.java:151)
  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1381)
  at android.os.Handler.dispatchMessage(Handler.java:110)
  at android.os.Looper.loop(Looper.java:193)
  at android.app.ActivityThread.main(ActivityThread.java:5299)
  at java.lang.reflect.Method.invokeNative(Native Method:0)
  at java.lang.reflect.Method.invoke(Method.java:515)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:829)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:645)
  at dalvik.system.NativeStart.main(Native Method:0)

Caused by: java.lang.ClassNotFoundException: 
  at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
  at android.app.Instrumentation.newApplication(Instrumentation.java:975)
  at android.app.LoadedApk.makeApplication(LoadedApk.java:511)

我已经将它添加到 gradle.build 中:

defaultConfig {
...
minSdkVersion 14
targetSdkVersion 21
...

// Enabling multidex support.
multiDexEnabled true
}

dependencies {
  compile 'com.android.support:multidex:1.0.0'
}

 @Override
    protected void attachBaseContext(Context newBase) {
        super.attachBaseContext(newBase);
        try {
            MultiDex.install(this);
        }catch (RuntimeException e){
            e.printStackTrace();
        }catch (Exception e){
            e.printStackTrace();
        }
    }

我在 android 4.4、5.0、5.1、6.0 中仍然遇到此错误。请帮忙!!

最佳答案

Android 中的 java.lang.ClassNotFoundException 有多种变体,其中大部分是由于 Proguard 配置错误、IDE 在构建期间未正确关闭先前启动的设备实例等引起的.

关注Unexpected crash in BaseDexClassLoader了解更多详情。

关于java.lang.ClassNotFoundException : dalvik. 系统.BaseDexClassLoader.findClass,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44880670/

相关文章:

java - 创建 Formatter 对象失败

android - 将 Google Home 响应转换到电视上的 Chromecast

java - 使用Jsoup库从android中的网站获取html表的数据,

Java:使用引导类路径阻止找到 H2 驱动程序

java - 分布式程序执行管理器

java - 为什么每次使用 javacc 工具解析赋值语句时语法检查都会失败?

java - JSP include指令和JSP include标签的区别之一

java - 计算返回无限值,为什么?

apache - 这个NoClassDefFoundError 应该怎么办?

java - ClassNotFoundException:org.postgresql.Driver