Как разрешить исключение com.android.builder.dexing.DexArchiveBuilderException?

1

Я получаю это исключение, когда пытаюсь создать приложение для флаттера и пробую разные решения, но ни одно из них мне пока не помогло. Я ищу решение по этому вопросу, так как это заняло много времени, чтобы решить эту проблему.

Приложение /build.grade:

   defaultConfig {
        applicationId "com.quickcarl.client"
        minSdkVersion 21
        targetSdkVersion 27
        multiDexEnabled true
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

        // needed to fix release build crash
        // ndk {
        //     abiFilters 'armeabi-v7a'
        // }
    }

    signingConfigs {
        release {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['storePassword']
            storeFile file(keystoreProperties['storeFile'])
            storePassword keystoreProperties['storePassword']
        }
    }

    buildTypes {
        release {
            signingConfig signingConfigs.release
        }
        debug {
            // applicationIdSuffix ".debug"
            signingConfig signingConfigs.debug
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    buildToolsVersion '28.0.3'
}

flutter {
    source '../..'
}

dependencies {
    implementation 'androidx.multidex:multidex:2.0.0'
    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    implementation 'androidx.legacy:legacy-support-v4:1.0.0-beta01'
    implementation 'androidx.appcompat:appcompat:1.0.0-beta01'
    implementation 'com.google.android.material:material:1.0.0-beta01'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'

    // Twilio Video library resides on jcenter
    implementation 'com.twilio:video-android:1.1.0'
    // required for twilio VideoActivity
    implementation 'com.koushikdutta.ion:ion:2.1.7'
    // firebase analytics
    implementation 'com.google.firebase:firebase-core:16.0.7'
    // firebase authentication
    implementation 'com.google.firebase:firebase-auth:16.0.5'
    // firebase cloud messaging
    implementation 'com.google.firebase:firebase-messaging:17.3.3'

    // required to resolve this issue:
    // https://stackoverflow.com/questions/52521302/how-to-solve-program-type-already-present-com-google-common-util-concurrent-lis
    implementation 'com.google.guava:guava:27.0.1-android'
}

apply plugin: 'com.google.gms.google-services'

верхний уровень build.grade:

dependencies {
        classpath 'com.android.tools.build:gradle:3.3.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.2.0'
    }

В текущей настройке уже есть multidexenabled=true и implementation 'com.google.guava:guava:27.0.1-android' которая казалась решением этой проблемы и была рекомендована в других постах, но не решила эту проблему для меня.,

Я продолжаю получать исключения, указывающие на jetified-play-services-measurement-base-16.3.0.aar о которой я понятия не имею, что делать. Ищете решение о том, как исправить это исключение.

Execution failed for task ':app:transformClassesWithDexBuilderForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.dexing.DexArchiveBuilderException: com.android.builder.dexing.DexArchiveBuilderException: Failed to process /Users/<username>/.gradle/caches/transforms-1/files-1.1/jetified-play-services-measurement-base-16.3.0.aar/ad108baaea5302bc328d2bf417082421/jars/classes.jar
Теги:
kotlin
gradle
flutter
build.gradle

2 ответа

0

Это решение отлично сработало, поэтому мне не приходилось менять альфа- и бета-версии или обновлять зависимые версии.

0

Замените все alpha, beta версии библиотеки стабильными версиями, как показано ниже:

implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'com.google.android.material:material:1.0.0'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' 

И измените зависимости на последние версии, как показано ниже:

com.google.firebase:firebase-auth:16.2.1
com.google.firebase:firebase-core:16.0.8
com.google.firebase:firebase-messaging:17.6.0
  • 0
    Хорошо, есть некоторые успехи после внесения вышеуказанных изменений. Хотя сейчас я получаю это исключение: jetified-play-services-measurement-sdk-16.4.0.aar/c95d832adb9327e41d22114a667fba52/jars/classes.jar . Первоначальное исключение было: jetified-play-services-measurement-base-16.3.0.aar/ad108baaea5302bc328d2bf417082421/jars/classes.jar
  • 0
    Таким же образом, проверьте, что все ваши зависимости, плагины имеют последние версии. Более того, убедитесь, что вы поместили google() на первое место в блоке репозиториев.

Ещё вопросы

Сообщество Overcoder
Наверх
Меню