Reputation: 23
I try to learn Google Map API from this tutorial(https://github.com/googlemaps/android-samples). However I got error message when I run the app. this problem provably simple issue but I'm a beginner of using android studio and Google Map API. so I have any idea to solve this....
Please give me some advice.
error message
'Execution failed for task':app:transformClassesWithDexForDebug' com.android.build.api.transform.TransformException: java.util.concurrent.ExecutionException:com.android.dex.DeIndexOverFlowException: method ID not in [0,0xffff]:65536
this is what I did.
1)download the zip file. (https://github.com/googlemaps/android-samples)
2)open AndroidStudio and Import project from using 'Import project(Eclipse ADT,Gradle,etc...)'
3)put Google MAP API key in 'gradle.properties' file.
4)run
Upvotes: 0
Views: 80
Reputation: 5062
I'm assuming that you are referring to ApiDemos and tutorials under googlemaps/android-samples
compile 'com.google.android.gms:play-services-maps'
compile 'com.google.android.gms:play-services'
The second one will deal with all play services apis instead of specific one. So you are facing the 65K limit problem.
Try using the individual api (like com.google.android.gms:play-services-maps
) for all samples under googlemaps/android-samples
Upvotes: 0
Reputation: 2148
You have too many methods. There can only be 65536 methods for dex.
You need to include multi-dex
Add these lines in build gradle
android {
defaultConfig {
...
// Enabling multidex support.
multiDexEnabled true
}
...
}
dependencies {
compile 'com.android.support:multidex:1.0.1'
}
Also in your Manifest add the MultiDexApplication class from the multidex support library to the application element
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.multidex.myapplication">
<application
...
android:name="android.support.multidex.MultiDexApplication">
...
</application>
</manifest>
Upvotes: 1