【发布时间】:2017-02-13 17:13:03
【问题描述】:
当我添加时,我正在尝试在我的项目中添加谷歌播放服务
编译 'com.google.android.gms:play-services:8.+'
或更低版本我的项目工作正常
当我添加时
com.google.android.gms:play-services:9.+ 或 com.google.android.gms:play-services:9.6。 1
我收到一个错误,错误是:
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
而当我使用上述语句时它工作正常有人可以解释或给我一个解决它的方法是什么问题!!。
Gradle 文件是:
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
}
【问题讨论】:
-
检查我的答案
-
已经被问过很多次了。请检查 Multi Dex。请在发布相同问题之前进行一些研究。
标签: android android-gradle-plugin google-play-services