【发布时间】:2016-04-11 01:53:13
【问题描述】:
我需要将 Firebase 和 Google Play 服务(用于地图)添加到我的应用程序中,但是将它们作为依赖项添加到 build.gradle 会在运行时出现此错误:
* What went wrong:
Execution failed for task ':app:dexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException:
Process 'command 'C:\Program Files\Java\jdk1.8.0_45\bin\java.exe''
finished with non-zero exit value 2
对 StackOverflow 的搜索表明这是由重复的库引起的,但我不确定如何找出正在复制的库。问题肯定出在 Firebase 和 Google Play 服务上,因为应用程序单独成功构建,但不包括两者。
这是我的 build.gradle 文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.example.shounakk.myfirebasetest"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:design:23.2.1'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.firebase:firebase-client-android:2.3.1'
}
非常感谢所有帮助!
【问题讨论】:
标签: java android google-maps gradle firebase