Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/234.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何解决com.android.builder.dexing.DexArchiveBuilderException?_Android_Gradle_Kotlin_Flutter_Build.gradle - Fatal编程技术网

如何解决com.android.builder.dexing.DexArchiveBuilderException?

如何解决com.android.builder.dexing.DexArchiveBuilderException?,android,gradle,kotlin,flutter,build.gradle,Android,Gradle,Kotlin,Flutter,Build.gradle,我在尝试构建Flatter应用程序时遇到了这个异常,并尝试了各种解决方案,但都没有帮助到我。我正在寻找解决这个问题的办法,因为解决这个问题很费时 app/build.grade: defaultConfig { applicationId "com.quickcarl.client" minSdkVersion 21 targetSdkVersion 27 multiDexEnabled true versio

我在尝试构建Flatter应用程序时遇到了这个异常,并尝试了各种解决方案,但都没有帮助到我。我正在寻找解决这个问题的办法,因为解决这个问题很费时

app/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'
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'
    }
顶级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'
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
实现'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
任务执行失败:应用程序:transformClassesWithDexBuilderForDebug'。
>com.android.build.api.transform.TransformException:com.android.builder.DexArchiveBuilderException:com.android.builder.DexArchiveBuilderException:未能处理/Users/.gradle/caches/transforms-1/files-1.1/jetified-play-services-measurement-base-16.3.0.aar/ad108baae5302bc328d2bf417082421/jars/classes.jar

用以下稳定版本替换库的所有
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
并将依赖项更改为最新版本,如下所示:

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

这个解决方案非常适合我,所以我不必更改alpha和beta版本或更新依赖版本。

好的,在进行上述更改后,有了一些进展。尽管现在,我得到了这个例外:
jetified-play-services-measurement-sdk-16.4.0.aar/c95d832adb9327e41d22114a667fba52/jars/classes.jar
。最初的例外情况是:
jetified-play-services-measurement-base-16.3.0.aar/ad108baae5302bc328d2bf417082421/jars/classes.jar
同样,检查所有依赖项、插件是否都有最新版本。此外,请确认您已将
google()
放在存储库块的第一位。