shong shong - 1 year ago 130
Android Question

Android Studio: Why am i getting multi dex error on brand new Google Maps API project?

I'm relatively new to Android programming and I am trying to create a Google Maps project. I used the template option in Android Studio, and I added the key for the API.

I haven't added any of my own code and left the template code as is because I just wanted to run the code and see what it looks like, however, I keep getting a multi dex error when I try to run this on the emulator causing the build to fail. It's weird to me that I am getting this error because I haven't added ANY code at all and am using what the Google Maps template has from Android Studio.

Anyone know why this error shows up on a brand new project? The error I see is pasted below.

Error:The number of method references in a .dex file cannot exceed 64K.
Learn how to resolve this issue at

Error:Execution failed for task ':app:transformClassesWithDexForDebug'. java.util.concurrent.ExecutionException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_91\bin\java.exe'' finished with non-zero exit value 2

Answer Source

as quoted below:

Your probably compiling all of the play-services API's using compile ''... Now we can selectively compile API's to avoid dex limit of 64K. For Google Maps use – Loki Jul 1 at 19:01

Answer from Loki worked and was very simple to do.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download