-4

I was interested in how you can use google maps in android studio. I followed a tutorial and I triple checked that everything was typed correctly but when I tried to build the apk, I got this error:

Error: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 ID not in [0, 0xffff]: 65536

Eric
  • 11
  • 4
  • 1
    It means that there are too many methods inside compiled code. Try to do internet search with DexIndexOverflowException ... Internet search with both DexIndexOverflowException and google play services would returns even more interesting results ... – Selvin Feb 28 '17 at 16:13

2 Answers2

2

I was interested in how you can use google maps in android studio

Use this

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

instead of this

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

If you want more Google Play Services than only maps see here

And if you go there, read

(emphasis mine)

If the number of method references in your app exceeds the 65K limit, your app may fail to compile. You may be able to mitigate this problem when compiling your app by specifying only the specific Google Play services APIs your app uses, instead of all of them

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
0

Ensure you are only adding the google play services api that you are using. In your case, you want only maps, so use this:

com.google.android.gms:play-services-maps:10.2.0

Instead of adding the whole package. A second option is to enable multi dex. Use the link: https://developer.android.com/studio/build/multidex.html for info about enabling multi dex.

Elvis Chidera
  • 201
  • 4
  • 10