错误:java.util.concurrent.ExecutionException:com.android.builder.internal.aapt.v2.Aapt2Exception:AAPT2错误:检查日志以获取详细信息
我的build.gradle(app)文件是:
`apply plugin: 'com.android.application'
android {
buildToolsVersion '27.0.3'
compileSdkVersion 27
defaultConfig {
applicationId "newsall1.shiva.newsall1"
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.google.firebase:firebase-core:16.0.0'
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:design:27.1.1'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.google.android.gms:play-services-ads:15.0.1'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-
core:3.0.2'
}
apply plugin: 'com.google.gms.google-services'`
答案 0 :(得分:4)
android {
....
aaptOptions.cruncherEnabled = false
aaptOptions.useNewCruncher = false
.....}
添加以上两行,生成签名的APK,并消除了构建发行版APK时的AAPT2错误。
答案 1 :(得分:0)
从android studio的菜单中选择构建选项,然后选择可以解决问题的清洁项目