在Android Studio中调试项目时出错,错误:app:mergeDebugResources失败

hgqdbh6s  于 2023-05-12  发布在  Android
关注(0)|答案(1)|浏览(152)

我做了一个Android App。但是,当我尝试调试我的应用时,我得到一个Gradle错误。我试着重新运行应用程序,但它不工作。我用Kotlin做了一个app。我的错误:

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上的其他问题并不能解决我的问题。
航站楼图片:MINGW64 Terminal
Stacktrace图片:Stacktrace提前感谢。

flmtquvp

flmtquvp1#

您可能在任何layout xml文件或AndroidManifest.xml文件中使用了tools:context属性。
如果是,则需要将 namespace 导入为xmlns:tools="http://schemas.android.com/tools",以便使用tools:context属性。

相关问题