Thursday, October 15, 2015

Unable to execute dex: method ID not in [0, 0xffff]: 65536


it in build.gradle:
android {
   defaultConfig {
      ...
      multiDexEnabled = true
   }
}


If your application supports Android prior to 5.0 (that is, if your minSdkVersion is 20 or below) you also have to dynamically patch the application ClassLoader, so it will be able to load classes from secondary dexes. Fortunately, there's a library that does that for you. Add it to your app's dependencies:
dependencies {
  ...
  compile 'com.android.support:multidex:1.0.0'
} 


Either add this to your Application.java
@Override
  protected void attachBaseContext(Context base) {
    super.attachBaseContext(base);
    MultiDex.install(this);
  }

No comments:

Post a Comment