Reputation: 879
I am trying to add google play services in my project when i add
compile 'com.google.android.gms:play-services:8.+'
or lower version my project works fine
when i add
com.google.android.gms:play-services:9.+ or com.google.android.gms:play-services:9.6.1
i receive an error and the error is:
Error:The number of method references in a .dex file cannot exceed 64K.
Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html
:app:transformClassesWithDexForDebug FAILED
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.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_101\bin\java.exe'' finished with non-zero exit value 2
Whereas when i use the above statement it works fine what is the issue can someone explain or give me a way to fix it!!.
Gradle File is:
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "MyPackageName"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.2.0'
compile 'com.google.android.gms:play-services:9.6.1'
//i tried 9.+ still receiving same error and also enabled the multidex option but failed
}
Upvotes: 2
Views: 212
Reputation: 3964
Add this line at the Bottom of build.gradle. in Module level
apply plugin: 'com.google.gms.google-services'
and in Project level
classpath 'com.google.gms:google-services:3.0.0
Upvotes: 0
Reputation: 3347
when you use google play service library.
first you refer this link: https://developers.google.com/android/guides/setup
Upvotes: 1