method ID not in [0, 0xffff]: 65536 error

While an error like this exist, there are simply too many methods in one of the dependencies. Multidex need to be enabled because one dex file can not contain them all.
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536

What google suggest:
https://developer.android.com/studio/build/multidex.html

what I do:


android {
defaultConfig {

multiDexEnabled true
}

}

dependencies {
compile ‘com.android.support:multidex:1.0.0’
}

==Credits goes to @Huy Nguyen on StackOverflow==

2017/2/14 14:43