每当我对项目中的 XML 文件进行任何更改并尝试运行它时,我都会收到此错误 -
任务“:app:mergeDebugResources”执行失败。
java.lang.IllegalArgumentException:无法找到资源文件(D:Q\app\build\intermediates\merged-not-compiled-resources\debug\layout\notification_action.xml)
在源集中。
为了运行项目,每次对 XML 进行任何更改时,我都需要执行“构建”>“清理项目”。
以下是我的成绩档案 -
plugins {
id 'com.android.application'
}
android {
compileSdk 32
defaultConfig {
applicationId "xxxxx"
minSdk 21
targetSdk 32
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
debug {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.6.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'com.github.ybq:Android-SpinKit:1.4.0'
}
简而言之:
“清理项目并继续前进”
细节:
转到 android studio 中的“构建选项卡”> 然后单击“清理项目”。
享受!
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)