【发布时间】:2017-09-08 17:26:36
【问题描述】:
我收到此错误:
错误:任务执行失败 ':app:transformClassesWithDexForDebug'.
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException:com.android.dex.DexException: 多个dex文件定义Lcom/google/android/gms/internal/zzeg;
运行应用程序时!
但我猜问题出在 gradle 中。我搜索了解决方案,发现可能有不同版本的播放服务声明。但是我没有发现任何错误!
请帮我解决问题。我是 Firebase 和依赖项的新手。
这是我的构建 gradle(应用程序):
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.google.gms:google-services:3.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com" // Google's Maven repository
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
这是 build.gradle(project) 文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.eaglewap.cleancity"
minSdkVersion 17
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
// Displaying images
compile 'com.github.bumptech.glide:glide:3.6.1'
//Firebase
compile 'com.google.firebase:firebase-database:11.2.2'
compile 'com.google.firebase:firebase-storage:11.2.2'
compile 'com.google.firebase:firebase-auth:11.2.2'
compile 'com.google.firebase:firebase-messaging:11.2.2'
compile 'com.google.firebase:firebase-config:11.2.2'
//Firebase UI
// Single target that includes all FirebaseUI libraries above
compile 'com.firebaseui:firebase-ui:2.3.0'
compile 'com.android.support:appcompat-v7:26.0.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
【问题讨论】:
标签: java android gradle android-gradle-plugin build.gradle