java.lang.NoClassDefFoundError: Could not initialize class XXX

后端 未结 10 1218
無奈伤痛
無奈伤痛 2020-11-27 10:59
public class PropHolder {
  public static Properties prop;

  static {
    //code for loading properties from file
  }
}

// Referencing the class somewhere else:
Pr         


        
10条回答
  •  孤城傲影
    2020-11-27 11:27

    I had the same exception - but only while running in debug mode, this is how I solved the problem (after 3 whole days): in the build.gradle i had : "multiDexEnabled true" set in the defaultConfig section.

            defaultConfig {
        applicationId "com.xxx.yyy"
        minSdkVersion 15
        targetSdkVersion 28
        versionCode 5123
        versionName "5123"
        // Enabling multidex support.
        multiDexEnabled true
    }
    

    but apparently this wasn't enough. but when i changed:

    public class MyAppClass  extends Application 
    

    to:

    public class MyAppClass  extends MultiDexApplication 
    

    this solved it. hope this will help someone

提交回复
热议问题