You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Android Studio调试项目报错:app:mergeDebugResources执行失败

Android Gradle资源编译错误::app:mergeDebugResources失败

用Kotlin开发Android应用时,调试阶段遇到Gradle编译错误,重启应用后问题依旧。具体报错信息如下:

error : 
Execution failed for task ':app:mergeDebugResources'.

A failure occurred while executing 
     com.android.build.gradle.internal.res.ResourceCompilerRunnable
        
Resource compilation failed. Check logs for details.

模块级Gradle配置文件内容:

plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
    id 'com.google.gms.google-services'
}

android {
    compileSdk 32

    defaultConfig {
        applicationId "com.lordshivaproduct.commenting_FROM_SHIVAN"
        minSdk 23
        targetSdk 32
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        vectorDrawables {
            useSupportLibrary true
        }
    }

    buildTypes {
        …
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = '1.8'
    }
    buildFeatures {
        …
    }
    composeOptions {
        kotlinCompilerExtensionVersion = "1.3.0-beta01"
    }
    packagingOptions {
        resources {
            excludes += '/META-INF/{AL2.0,LGPL2.1}'
        }
    }
    ext.kotlin_version = '1.6.10'
}

dependencies {
    implementation 'androidx.core:core-ktx:1.8.0'
    implementation 'com.google.firebase:firebase-core:21.1.0'
    implementation 'com.google.firebase:firebase-auth:21.0.6'
    implementation 'androidx.appcompat:appcompat:1.4.2'
    implementation 'com.google.firebase:firebase-database-ktx:20.0.5'
    implementation 'com.google.firebase:firebase-storage:20.0.1'
    implementation 'com.firebaseui:firebase-ui-database:8.0.1'
    implementation 'com.github.bumptech.glide:glide:4.13.2'
    implementation "androidx.compose.ui:ui:$compose_version"
    implementation 'androidx.compose.material3:material3:1.0.0-alpha14'
    implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
    implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.5.0'
    implementation 'androidx.activity:activity-compose:1.3.1'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    implementation 'androidx.viewpager2:viewpager2:1.0.0'
    implementation 'com.google.android.material:material:1.6.1'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
    implementation 'androidx.recyclerview:recyclerview:1.2.1'
    implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
    implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
    androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
    debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
    debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_version"
}

已尝试Stack Overflow上的常见解决方案,但均无法解决问题。补充信息:终端截图显示了编译过程中资源合并阶段的错误细节,堆栈跟踪截图包含完整的错误调用栈信息。

提前感谢各位的帮助。

内容的提问来源于stack exchange,提问作者LORD SHIVA PRODUCT

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.22 13:50:43