背景
最近因为要做多module模块,出现aapt报错,于是简单记录下,踩坑过程。
1、我一开始项目中三个module,然后在build.gradle设置androidApplication
plugins {
alias(libs.plugins.androidApplication)
}
2、运行完之后都是报下面错误,信息说aapt错误,如下图所示。
3、接着我又带入另外一个坑,于是我尝试在项目主工程目录gradle.properties中添加android.enableAapt2=false 关闭aapt开关,结果fail.
4、最后按照以下大佬博客修改如下【Gradle配置】AAPT2 aapt2-7.0.3-7396180-windows Daemon #0: Unexpected error during link_unexpected error during link, attempting to stop d-CSDN博客
plugins {
alias(libs.plugins.androidLibrary)
}
android {
namespace 'com.xxx.xx.lib'
compileSdk 34
defaultConfig {
minSdk 23
targetSdk 34
versionCode 1
versionName "1.0"
consumerProguardFiles "consumer-rules.pro"
// testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation libs.androidx.appcompat
implementation libs.material
implementation libs.androidx.activity
implementation libs.androidx.constraintlayout
testImplementation libs.junit
androidTestImplementation libs.androidx.junit
androidTestImplementation libs.androidx.espresso.core
}
5、感谢,转载请注明出处高通Android 12 aapt报错问题踩坑-CSDN博客,谢谢!
5.1【Gradle配置】AAPT2 aapt2-7.0.3-7396180-windows Daemon #0: Unexpected error during link_unexpected error during link, attempting to stop d-CSDN博客
5.2 Android Gradle build error "AAPT2 aapt2-4.1.0-6503028-windows Daemon #0: Unexpected error during link, attempting to stop daemon." - Stack Overflow