簡體   English   中英

錯誤:任務':app:transformClassesWithMultidexlistForDebug'的執行失敗。 在添加Firebase身份驗證時

[英]Error:Execution failed for task ':app:transformClassesWithMultidexlistForDebug'. while adding firebase authentication

整天都在遭受這個錯誤的困擾。

請不要將此問題標記為重復。我經歷過許多類似的問題,但沒有一個答案對我有用。

完全錯誤:

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]))

我已經嘗試過的事情:

  1. 清理並重建
  2. 使緩存無效並重新啟動
  3. 在我的項目文件夾中刪除了.gradle並重新同步了該項目。
  4. 刪除了android studio的整個.gradle(在Users / Username / .gradle中) 幾乎2.5Gb的數據,然后嘗試再次同步。
  5. 添加 :

    android {

    defaultConfig {

    multiDexEnabled true

    }}

分發文件:

我的完整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'

頂級gradle:

// 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身份驗證后發生此錯誤。

PS:刪除firebase身份驗證依賴關系並重建項目不會顯示任何錯誤。 即刪除

implementation 'com.google.firebase:firebase-auth:11.8.0'
implementation 'com.firebaseui:firebase-ui-auth:3.2.2'

刪除錯誤,但我想在我的項目中使用Firebase Auth。

firebase firebase-ui-auth:3.2.2支持的支持庫是27.0.2而不是27.1.0

所以改變:

implementation 'com.android.support:appcompat-v7:27.1.0'

implementation 'com.android.support:appcompat-v7:27.0.2'

FirebaseUi-Android版本

正如@Jagar在他的回答中所解釋的,FirebaseUI 3.2.2具有對支持庫27.0.2的傳遞依賴 如果要使用其他版本的支持庫(例如27.1.0)進行構建,則必須按照文檔中描述的說明在依賴中添加適當的庫。 就您而言,對於FirebaseUI身份驗證,這些是:

implementation 'com.android.support:design:27.1.0'
implementation 'com.android.support:customtabs:27.1.0'
implementation 'com.android.support:cardview-v7:27.1.0'

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM