In my android application, I have a function that works with GCM and I use google_play_services_lib.
Now I am implementing MapBox maps, no Google maps.
I did various tests in a separate project with MapBox and perfect, but when I compile both dependencies, the applicattion not runs.
I think my problem is of dependencies between google play services and map box.
Here is my script and my log. I hope you can help me. Thank you.
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
defaultConfig {
applicationId "storecheck.com.storecheck2"
minSdkVersion 9
targetSdkVersion 20
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile ('com.mapbox.mapboxsdk:mapbox-android-sdk:0.7.1@aar'){
transitive=true
}
compile 'joda-time:joda-time:2.2'
compile 'com.google.android.gms:play-services:+'
compile 'com.android.support:appcompat-v7:20.0.0'
compile "commons-io:commons-io:+"
compile "org.apache.httpcomponents:httpmime:4.2.3"
}
Log
Information:Gradle tasks [:app:assembleDebug]
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:compileDebugNdk UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72000Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42200Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServices700Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAds700Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAnalytics700Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppindexing700Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppstate700Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBase700Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesCast700Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesDrive700Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesFitness700Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesGames700Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesGcm700Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesIdentity700Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesLocation700Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesMaps700Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesNearby700Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesPanorama700Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesPlus700Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesSafetynet700Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesWallet700Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesWearable700Library UP-TO-DATE
:app:prepareComMapboxMapboxsdkMapboxAndroidSdk071Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:compileDebugJava UP-TO-DATE
:app:preDexDebug UP-TO-DATE
:app:dexDebug
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536
at com.android.dx.merge.DexMerger$6.updateIndex(DexMerger.java:502)
at com.android.dx.merge.DexMerger$IdMerger.mergeSorted(DexMerger.java:277)
at com.android.dx.merge.DexMerger.mergeMethodIds(DexMerger.java:491)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:168)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)
at com.android.dx.command.dexer.Main.run(Main.java:246)
at com.android.dx.command.dexer.Main.main(Main.java:215)
at com.android.dx.command.Main.main(Main.java:106)
Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/opt/java/jdk1.7.0_65/bin/java'' finished with non-zero exit value 2.
Well, My project is in Android Studio. I tried in Eclipse, and I downloaded source code of MapBox and all dependencies. But, the project no compile .
Shows errors as
"[2015-04-15 11:28:26 - Dex Loader] Unable to execute dex: Multiple dex files define Lcom/almeros/android/multitouch/TwoFingerGestureDetector;"
Researching, I found this post.
https://stackoverflow.com/a/18177694/3814000
And in the comments says:
"This error can happen if you have two jars that contains the same class names, e.g. I had two library: jsr311-api-1.1.1.jar, and jersey-core-1.17.1.jar, both containing the class javax.ws.rs.ApplicationPath. I removed jsr311-api-1.1.1.jar and it worked fine."
I think that the google play services lib and map box has this problem.
But I am not sure