Android Studio: ClassNotFoundException

后端 未结 17 888
时光说笑
时光说笑 2021-01-11 13:23

i was busy with my app for over a week, when suddenly:

11-12 07:59:17.860    1653-1653/nl.test.myapp E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.Runtim         


        
17条回答
  •  被撕碎了的回忆
    2021-01-11 14:15

    You can check Multidex mechanism. The reason may be method numbers overflow.

    1. Add MultiDex.install(this); to your Application:

      @Override
      protected void attachBaseContext(Context base) {
           super.attachBaseContext(base);
           MultiDex.install(this);
      }
      
    2. and add

      afterEvaluate {
         tasks.matching {
             it.name.startsWith('dex')
         }.each { dx ->
             if (dx.additionalParameters == null) {
                 dx.additionalParameters = []
             }
             dx.additionalParameters += '--multi-dex' // enable multidex
         }
      }
      

    to your app module's gradle.build

提交回复
热议问题