1

This was working fine on a Windows machine but I am trying to work on a Mac now and I'm getting DexIndexOverflowException. I have multiDexEnabled true in my build.gradle. I have extended the MultiDexApplication class and that class is in my AndroidManifest file.

compile 'com.android.support:multidex:1.0.1' is in my dependencies

I still get DexIndexOverflowException. I added the following to my MultiDexApplication class and it still didn't work:

@Override
public void attachBaseContext(Context base) {
    MultiDex.install(base);
    super.attachBaseContext(base);
}
Questioner
  • 2,451
  • 4
  • 29
  • 50

1 Answers1

0

I had the same issue. What worked for me was to selectively compile Google Play service APIs into my app. For example, in my case I was using Google Maps API, I had this in my gradle before:

compile 'com.google.android.gms:play-services:9.6.1'

I had to change to these lines:

compile 'com.google.android.gms:play-services-maps:9.6.1' compile 'com.google.android.gms:play-services-location:9.6.1'

so that not the whole Play Services API are compiled into my app.

user1506104
  • 6,554
  • 4
  • 71
  • 89
  • It was actually a silly mistake. I had multidex enabled for the 'release' build type but I had the 'debug' build variant selected. – Questioner Oct 18 '16 at 11:11