Unable to build APK using "com.google.android.gms: play-services: 9.4.0"

I started using Google Play Services for my little game. As in the manual, I added compile 'com.google.android.gms:play-services:9.4.0'to mine build.gradle(Module: app).

Since then I can’t build my apk, but I can still run it on my phone. I get the following error creating apk:

Error: execution completed for task ': app: transformClassesWithDexForDebug'. com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexIndexOverflowException: method identifier not in [0, 0xffff]: 65536

FAILURE: build failed with exception.

What went wrong: Execution failed for task ': app: transformClassesWithDexForDebug'. com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexIndexOverflowException: method identifier not in [0, 0xffff]: 65536 Try: Run with the --stacktrace option to get a stack trace. Run with the --info or --debug option to get more log output.

thank

+4
source share
1 answer

First install multiDexEnabledin yours build.gradle.

defaultConfig {
    // ...
    multiDexEnabled true
}

, , - com.google.android.gms:play-services:9.4.0. , . dependencies.

, gcm places.

dependencies {
    //...
    compile 'com.google.android.gms:play-services-gcm:9.2.0'
    compile 'com.google.android.gms:play-services-places:9.2.0'
    compile 'com.android.support:multidex:1.0.1'
}

.

Example image from a link

+6

Source: https://habr.com/ru/post/1651930/


All Articles