gpt4 book ai didi

android - Android构建失败。在添加Firebase Performance SDK之后

转载 作者:行者123 更新时间:2023-12-03 05:34:26 28 4
gpt4 key购买 nike

环境

  • Android Studio版本:3.4.2

  • 问题

    When I add apply plugin in gradle, the build failed.



    我根据 guidelines添加了Firebase性能sdk。
    并且,如果启用了minify( 构建类型:release ),则构建没有问题。但是,禁用minify时构建失败( buildtype:debug )。在测试期间,我通过删除 apply plugin: 'com.google.firebase.firebase-perf'行发现该构建成功。

    build.gradle(项目级别)
    // Top-level build file where you can add configuration options common to all sub-projects/modules.
    buildscript {

    ext {
    kotlin_version = '1.3.41'
    nav_version = '2.1.0-alpha05'
    kodein_version = '6.3.3'
    debug_drawer_version = '0.7.0'
    stetho_version = '1.5.0'
    glide_version = '4.9.0'
    okhttp3_version = '3.10.0'
    retrofit_version = '2.6.0'
    gson_version = '2.8.5'
    lifecycle_version = '2.2.0-alpha01'
    }

    repositories {
    google()
    jcenter()
    }

    dependencies {
    classpath 'com.android.tools.build:gradle:3.4.0'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    classpath 'io.realm:realm-gradle-plugin:5.8.0'
    classpath 'com.google.gms:google-services:4.3.0'
    classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"
    classpath 'com.google.firebase:perf-plugin:1.3.1'
    }
    }

    allprojects {
    repositories {
    google()
    jcenter()
    }
    }

    task clean(type: Delete) {
    delete rootProject.buildDir
    }

    build.gradle(应用级别)
    apply plugin: 'com.google.firebase.firebase-perf' // if remove this line, build successful
    apply plugin: 'com.android.application'
    apply plugin: 'kotlin-android'
    apply plugin: 'kotlin-android-extensions'
    apply plugin: 'kotlin-kapt'
    apply plugin: 'realm-android'
    apply from: '../jacoco.gradle'
    apply plugin: "androidx.navigation.safeargs.kotlin"

    android {
    compileSdkVersion 28
    buildToolsVersion '28.0.3'

    useLibrary 'org.apache.http.legacy'

    defaultConfig {
    applicationId ...
    targetSdkVersion 28
    minSdkVersion 19

    vectorDrawables.useSupportLibrary = true
    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

    multiDexEnabled true
    }

    packagingOptions {
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/rxjava.properties'
    exclude 'META-INF/atomicfu.kotlin_module'
    exclude 'lib/arm64-v8a/libcardioDecider.so'
    exclude 'lib/arm64-v8a/libcardioRecognizer.so'
    exclude 'lib/arm64-v8a/libcardioRecognizer_tegra2.so'
    exclude 'lib/arm64-v8a/libopencv_core.so'
    exclude 'lib/arm64-v8a/libopencv_imgproc.so'
    exclude 'lib/armeabi/libcardioDecider.so'
    exclude 'lib/armeabi-v7a/libcardioDecider.so'
    exclude 'lib/armeabi-v7a/libcardioRecognizer.so'
    exclude 'lib/armeabi-v7a/libcardioRecognizer_tegra2.so'
    exclude 'lib/armeabi-v7a/libopencv_core.so'
    exclude 'lib/armeabi-v7a/libopencv_imgproc.so'
    exclude 'lib/mips/libcardioDecider.so'
    exclude 'lib/x86/libcardioDecider.so'
    exclude 'lib/x86/libcardioRecognizer.so'
    exclude 'lib/x86/libcardioRecognizer_tegra2.so'
    exclude 'lib/x86/libopencv_core.so'
    exclude 'lib/x86/libopencv_imgproc.so'
    exclude 'lib/x86_64/libcardioDecider.so'
    exclude 'lib/x86_64/libcardioRecognizer.so'
    exclude 'lib/x86_64/libcardioRecognizer_tegra2.so'
    exclude 'lib/x86_64/libopencv_core.so'
    exclude 'lib/x86_64/libopencv_imgproc.so'
    }

    dataBinding.enabled = true

    compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
    }

    dexOptions {
    javaMaxHeapSize "4g"
    maxProcessCount 8
    }

    kapt {
    correctErrorTypes = true
    useBuildCache = true

    javacOptions {
    // Increase the max count of errors from annotation processors.
    // Default is 100.
    option("-Xmaxerrs", 500)
    }
    }

    lintOptions {
    abortOnError false
    }

    signingConfigs {
    release {
    ...
    }
    }

    buildTypes {
    debug {
    debuggable true
    }
    debugRelease {
    minifyEnabled true
    testCoverageEnabled true
    proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    signingConfig signingConfigs.release
    matchingFallbacks = ['debug']
    }
    snapshot {
    minifyEnabled true
    proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    signingConfig signingConfigs.release
    matchingFallbacks = ['debug']
    }
    release {
    minifyEnabled true
    proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    signingConfig signingConfigs.release
    }
    }

    flavorDimensions "region"

    productFlavors {
    global {
    ...
    }
    china {
    ...
    }
    }

    sourceSets {
    ...
    }

    applicationVariants.all { variant ->
    ...
    }
    }

    def getStoreName(flavorName) {
    ...
    }

    def getDate() {
    ...
    }

    configurations.all {
    ...
    }

    dependencies {

    // module
    api project(path: ':base')
    api project(path: ':entity')

    implementation fileTree(dir: 'libs', include: ['*.jar'])

    // AndroidX
    androidTestImplementation 'androidx.annotation:annotation:1.0.0'
    androidTestImplementation 'androidx.test:runner:1.1.0'

    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.annotation:annotation:1.0.1'
    implementation 'androidx.multidex:multidex:2.0.1'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'androidx.percentlayout:percentlayout:1.0.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'
    implementation 'androidx.browser:browser:1.0.0'
    implementation 'androidx.paging:paging-runtime:2.1.0'
    implementation 'androidx.core:core-ktx:1.0.2'
    implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version"
    implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"

    // Kotlin
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
    implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.2.0'

    // Google Services
    implementation 'com.google.android.material:material:1.1.0-alpha03'
    implementation 'com.google.firebase:firebase-core:17.0.1'
    implementation 'com.google.firebase:firebase-dynamic-links:18.0.0'
    implementation 'com.google.firebase:firebase-perf:18.0.1'
    implementation 'com.google.code.gson:gson:2.8.5'
    implementation 'com.google.android.gms:play-services-base:17.0.0'
    implementation 'com.google.android.gms:play-services-auth:17.0.0'
    implementation 'com.google.android.gms:play-services-maps:17.0.0'
    implementation 'com.google.android.gms:play-services-location:17.0.0'
    implementation 'com.google.android.gms:play-services-analytics:17.0.0'
    implementation 'com.google.android.libraries.places:places:2.0.0'

    // Network Library
    implementation "com.squareup.okhttp3:logging-interceptor:$okhttp3_version"
    implementation "com.squareup.okhttp3:okhttp-urlconnection:$okhttp3_version"
    implementation "com.squareup.retrofit2:retrofit:$retrofit_version"
    implementation "com.squareup.retrofit2:converter-gson:$retrofit_version"
    implementation "com.squareup.retrofit2:adapter-rxjava:$retrofit_version"
    implementation "com.squareup.retrofit2:adapter-rxjava2:$retrofit_version"
    implementation('org.apache.httpcomponents:httpmime:4.3.6') { exclude module: 'httpclient' }
    implementation 'org.apache.httpcomponents:httpclient-android:4.3.5'
    implementation 'com.android.volley:volley:1.1.1'

    // Rx2
    implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
    implementation 'io.reactivex.rxjava2:rxjava:2.1.12'
    implementation 'io.reactivex.rxjava2:rxkotlin:2.2.0'
    implementation 'com.jakewharton.rxbinding2:rxbinding:2.1.1'
    implementation 'com.jakewharton.rxbinding2:rxbinding-support-v4:2.1.1'
    implementation 'com.jakewharton.rxbinding2:rxbinding-recyclerview-v7:2.1.1'

    // View
    implementation 'me.grantland:autofittextview:0.2.1'
    implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.0'
    implementation 'com.wang.avi:library:2.1.3'
    implementation 'com.facebook.shimmer:shimmer:0.2.0'

    // Image Loader
    implementation "com.github.bumptech.glide:glide:$glide_version"

    // SNS
    implementation('com.twitter.sdk.android:twitter-core:3.3.0@aar') { transitive = true }

    // Debug
    implementation "com.facebook.stetho:stetho:$stetho_version"
    implementation "com.facebook.stetho:stetho-okhttp3:$stetho_version"
    implementation 'com.uphyca:stetho_realm:2.2.2'
    debugImplementation "io.palaima.debugdrawer:debugdrawer:$debug_drawer_version"
    debugReleaseImplementation "io.palaima.debugdrawer:debugdrawer:$debug_drawer_version"
    releaseImplementation "io.palaima.debugdrawer:debugdrawer-no-op:$debug_drawer_version"
    snapshotImplementation "io.palaima.debugdrawer:debugdrawer-no-op:$debug_drawer_version"
    implementation "io.palaima.debugdrawer:debugdrawer-commons:$debug_drawer_version"

    // QR Code Reader
    implementation 'com.journeyapps:zxing-android-embedded:3.6.0'

    // Test
    testImplementation 'junit:junit:4.12'
    testImplementation 'org.mockito:mockito-core:2.23.4'
    testImplementation 'org.json:json:20180813'
    testImplementation 'org.testng:testng:6.14.3'

    // Payment
    implementation('com.paypal.sdk:paypal-android-sdk:2.16.0') { exclude group: 'io.card' }

    // Crash Report
    implementation('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') { transitive = true }

    // App Rebirth
    implementation 'com.jakewharton:process-phoenix:2.0.0'

    // Dependencies Only for Global
    globalImplementation fileTree(dir: 'src/global/libs', include: ['*.jar'])
    globalImplementation 'com.google.android.gms:play-services-identity:17.0.0'
    globalImplementation 'com.google.android.gms:play-services-plus:17.0.0'
    implementation 'com.facebook.android:facebook-android-sdk:4.34.0'

    globalImplementation 'com.google.firebase:firebase-messaging:19.0.1'

    // Dependencies Only For China
    chinaImplementation fileTree(dir: 'src/china/libs', include: ['*.jar'])
    chinaImplementation project(':libraries:weiboSDK')
    chinaImplementation 'com.umeng.analytics:analytics:latest.integration' // china analytics
    chinaImplementation 'me.pushy:sdk:1.0.27'

    // Permission
    implementation 'com.karumi:dexter:4.2.0'

    implementation 'com.otaliastudios:cameraview:1.6.1'

    // Logging
    implementation 'com.jakewharton.timber:timber:4.7.1'

    implementation 'com.pierfrancescosoffritti.androidyoutubeplayer:core:9.0.1'

    // Navigation
    implementation "androidx.navigation:navigation-fragment:$nav_version"
    implementation "androidx.navigation:navigation-ui:$nav_version"
    implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"

    implementation 'com.appsflyer:af-android-sdk:4.10.0'
    implementation 'com.android.installreferrer:installreferrer:1.0'
    }

    androidExtensions { experimental = true }

    buildscript {
    repositories {
    maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
    classpath 'io.fabric.tools:gradle:1.+'
    }
    }

    repositories {
    flatDir { dirs 'libs' }

    jcenter()
    maven { url 'https://maven.fabric.io/public' }
    maven { url 'https://github.com/WickeDev/stetho-realm/raw/master/maven-repo' }
    maven { url 'https://maven.google.com' }
    }

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

    异常记录
    > Task :app:transformClassesWithMultidexlistForChinaDebug
    AGPBI: {"kind":"error","text":"Cannot fit requested classes in the main-dex file (# methods: 68027 \u003e 65536)","sources":[{}],"tool":"D8"}

    > Task :app:transformDexArchiveWithDexMergerForChinaDebug FAILED
    java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
    at sun.reflect.GeneratedConstructorAccessor639.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:593)
    at java.util.concurrent.ForkJoinTask.reportException(ForkJoinTask.java:677)
    at java.util.concurrent.ForkJoinTask.join(ForkJoinTask.java:720)
    at com.google.common.collect.ImmutableList.forEach(ImmutableList.java:407)
    at com.android.build.gradle.internal.transforms.DexMergerTransform.transform(DexMergerTransform.java:244)
    at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:239)
    at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:235)
    at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:102)
    at com.android.build.gradle.internal.pipeline.TransformTask.transform(TransformTask.java:230)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:103)
    at org.gradle.api.internal.project.taskfactory.IncrementalTaskInputsTaskAction.doExecute(IncrementalTaskInputsTaskAction.java:46)
    at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:41)
    at org.gradle.api.internal.project.taskfactory.AbstractIncrementalTaskAction.execute(AbstractIncrementalTaskAction.java:25)
    at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:28)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$5.run(ExecuteActionsTaskExecuter.java:401)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:402)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:394)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:92)
    at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:390)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:373)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.access$200(ExecuteActionsTaskExecuter.java:79)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.execute(ExecuteActionsTaskExecuter.java:210)
    at org.gradle.internal.execution.steps.ExecuteStep.lambda$execute$0(ExecuteStep.java:32)
    at java.util.Optional.map(Optional.java:215)
    at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:32)
    at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:26)
    at org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:58)
    at org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:35)
    at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:48)
    at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:33)
    at org.gradle.internal.execution.steps.CancelExecutionStep.execute(CancelExecutionStep.java:39)
    at org.gradle.internal.execution.steps.TimeoutStep.executeWithoutTimeout(TimeoutStep.java:73)
    at org.gradle.internal.execution.steps.TimeoutStep.execute(TimeoutStep.java:54)
    at org.gradle.internal.execution.steps.CatchExceptionStep.execute(CatchExceptionStep.java:35)
    at org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:51)
    at org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:45)
    at org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:31)
    at org.gradle.internal.execution.steps.CacheStep.executeWithoutCache(CacheStep.java:201)
    at org.gradle.internal.execution.steps.CacheStep.executeAndStoreInCache(CacheStep.java:183)
    at org.gradle.internal.execution.steps.CacheStep.lambda$executeWithCache$2(CacheStep.java:106)
    at java.util.Optional.orElseGet(Optional.java:267)
    at org.gradle.internal.execution.steps.CacheStep.lambda$executeWithCache$3(CacheStep.java:106)
    at org.gradle.internal.Try$1.apply(Try.java:59)
    at org.gradle.internal.Try$1.apply(Try.java:56)
    at org.gradle.internal.Try$Success.flatMap(Try.java:102)
    at org.gradle.internal.Try.map(Try.java:56)
    at org.gradle.internal.execution.steps.CacheStep.executeWithCache(CacheStep.java:79)
    at org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:69)
    at org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:45)
    at org.gradle.internal.execution.steps.BroadcastChangingOutputsStep.execute(BroadcastChangingOutputsStep.java:49)
    at org.gradle.internal.execution.steps.StoreSnapshotsStep.execute(StoreSnapshotsStep.java:43)
    at org.gradle.internal.execution.steps.StoreSnapshotsStep.execute(StoreSnapshotsStep.java:32)
    at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:38)
    at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:24)
    at org.gradle.internal.execution.steps.SkipUpToDateStep.executeBecause(SkipUpToDateStep.java:96)
    at org.gradle.internal.execution.steps.SkipUpToDateStep.lambda$execute$0(SkipUpToDateStep.java:89)
    at java.util.Optional.map(Optional.java:215)
    at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:54)
    at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:38)
    at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:77)
    at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:37)
    at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:36)
    at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:26)
    at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:90)
    at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:48)
    at org.gradle.internal.execution.impl.DefaultWorkExecutor.execute(DefaultWorkExecutor.java:33)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:117)
    at org.gradle.api.internal.tasks.execution.ResolveBeforeExecutionStateTaskExecuter.execute(ResolveBeforeExecutionStateTaskExecuter.java:75)
    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:62)
    at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:108)
    at org.gradle.api.internal.tasks.execution.ResolveBeforeExecutionOutputsTaskExecuter.execute(ResolveBeforeExecutionOutputsTaskExecuter.java:67)
    at org.gradle.api.internal.tasks.execution.StartSnapshotTaskInputsBuildOperationTaskExecuter.execute(StartSnapshotTaskInputsBuildOperationTaskExecuter.java:62)
    at org.gradle.api.internal.tasks.execution.ResolveAfterPreviousExecutionStateTaskExecuter.execute(ResolveAfterPreviousExecutionStateTaskExecuter.java:46)
    at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:94)
    at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
    at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:95)
    at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
    at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
    at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
    at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:73)
    at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
    at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:49)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
    at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
    at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:49)
    at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:43)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:355)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:343)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:336)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:322)
    at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:134)
    at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:129)
    at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:202)
    at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:193)
    at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:129)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
    at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
    at java.lang.Thread.run(Thread.java:745)
    Caused by: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
    at java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1431)
    at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
    at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
    at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
    at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
    Caused by: com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
    at com.android.builder.dexing.D8DexArchiveMerger.getExceptionToRethrow(D8DexArchiveMerger.java:131)
    at com.android.builder.dexing.D8DexArchiveMerger.mergeDexArchives(D8DexArchiveMerger.java:118)
    at com.android.build.gradle.internal.transforms.DexMergerTransformCallable.call(DexMergerTransformCallable.java:102)
    at com.android.build.gradle.internal.transforms.DexMergerTransformCallable.call(DexMergerTransformCallable.java:37)
    at java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1424)
    ... 4 more
    Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete
    at com.android.tools.r8.utils.ExceptionUtils.withCompilationHandler(ExceptionUtils.java:81)
    at com.android.tools.r8.utils.ExceptionUtils.withD8CompilationHandler(ExceptionUtils.java:45)
    at com.android.tools.r8.D8.run(D8.java:94)
    at com.android.builder.dexing.D8DexArchiveMerger.mergeDexArchives(D8DexArchiveMerger.java:116)
    ... 7 more
    Caused by: com.android.tools.r8.utils.AbortException: Error: null, Cannot fit requested classes in the main-dex file (# methods: 68027 > 65536)
    at com.android.tools.r8.utils.Reporter.failIfPendingErrors(Reporter.java:101)
    at com.android.tools.r8.utils.Reporter.fatalError(Reporter.java:72)
    at com.android.tools.r8.dex.VirtualFile.throwIfFull(VirtualFile.java:193)
    at com.android.tools.r8.dex.VirtualFile$DistributorBase.fillForMainDexList(VirtualFile.java:328)
    at com.android.tools.r8.dex.VirtualFile$FillFilesDistributor.run(VirtualFile.java:380)
    at com.android.tools.r8.dex.ApplicationWriter.distribute(ApplicationWriter.java:200)
    at com.android.tools.r8.dex.ApplicationWriter.write(ApplicationWriter.java:221)
    at com.android.tools.r8.D8.run(D8.java:215)
    at com.android.tools.r8.D8.lambda$run$1(D8.java:97)
    at com.android.tools.r8.utils.ExceptionUtils.withCompilationHandler(ExceptionUtils.java:62)
    ... 10 more


    FAILURE: Build failed with an exception.

    * What went wrong:
    Execution failed for task ':app:transformDexArchiveWithDexMergerForChinaDebug'.
    > com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:

    BUILD FAILED in 1m 3s
    82 actionable tasks: 12 executed, 70 up-to-date

    为什么会这样呢?

    最佳答案

    看来您的方法数量已超过单个dex的限制,该数量经常在包含多个库的复杂应用程序中发生。

    请参阅有关multi-dex的以下问题:
    What is Android MultiDex?

    关于android - Android构建失败。在添加Firebase Performance SDK之后,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57323711/

    28 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com