【发布时间】:2018-03-18 10:44:52
【问题描述】:
整天都被这个错误困扰。
请不要将此问题标记为重复。我已经回答了许多类似的问题,但没有一个答案对我有用。
完全错误:
Error:Execution failed for task ':app:transformClassesWithMultidexlistForDebug'.
> java.io.IOException: Can't write [E:\Educational\Career\Android\Projects
\FirebaseTutorial\app\build\intermediates\multi-dex\debug\componentClasses.jar]
(Can't read [C:\Users\Abhi\.gradle\caches\transforms-1\files-1.1\support-core-ui-
27.1.0.aar\167562b027fa4c1af2f69bce0de3dd43\jars\classes.jar(;;;;;;**.class)]
(Duplicate zip entry [classes.jar:android/support/design/widget/CoordinatorLayout
$Behavior.class]))
我已经尝试过的事情:
- 清理并重建
- 使缓存无效并重新启动
- 在我的项目文件夹中删除了 .gradle 并重新同步了项目。
- 删除了整个 .gradle 的 android studio(在用户/用户名/.gradle 中)几乎 2.5Gb 的数据并再次尝试同步。
-
添加:
android {defaultConfig {multiDexEnabled true}}
到 gradle 文件:
我的完整 gradle 文件:
应用:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.appz.abhi.firebasetutorial"
minSdkVersion 19
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.firebase:firebase-database:11.8.0'
implementation 'com.google.firebase:firebase-storage:11.8.0'
implementation 'com.google.firebase:firebase-auth:11.8.0'
implementation 'com.firebaseui:firebase-ui-auth:3.2.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
apply plugin: 'com.google.gms.google-services'
顶级等级:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:3.2.0'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
添加 firebase 身份验证后出现此错误。
P.S:删除 firebase auth 依赖项并重建项目不会显示任何错误。即删除
implementation 'com.google.firebase:firebase-auth:11.8.0'
implementation 'com.firebaseui:firebase-ui-auth:3.2.2'
删除错误,但我希望在我的项目中使用 firebase Auth。
【问题讨论】:
-
你试过加
implementation 'com.android.support.multidex:1.0.2'吗? -
@AlejandroBertinelli 感谢您的回答。接受的答案解决了我的问题。
标签: android firebase firebase-authentication