更新后Android Studio 3.3到3.4 AAPT2生成错误

幽沉谢世事,俯默窥唐虞。这篇文章主要讲述更新后Android Studio 3.3到3.4 AAPT2生成错误相关的知识,希望能为你提供帮助。
更新android Studio 3.3到3.4之后会出现错误。它得到的错误是AAPT2,这让我建议我喜欢这个:
在此版本中使用了不推荐使用的Gradle功能,使其与Gradle 6.0不兼容。使用'--warning-mode all'显示各个弃用警告。看到

gradle.properties org.gradle.warning.mode=all

但它仍然无法正常工作。
错误:
FAILURE: Build failed with an exception.* What went wrong: Execution failed for task ':app:mergeIntroMakerDebugResources'. > 8 exceptions were raised by workers: com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.0-5326820-windows Daemon #2: Daemon startup failed This should not happen under normal circumstances, please file an issue if it does. com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.0-5326820-windows Daemon #0: Daemon startup failed This should not happen under normal circumstances, please file an issue if it does. com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.0-5326820-windows Daemon #1: Daemon startup failed This should not happen under normal circumstances, please file an issue if it does. com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.0-5326820-windows Daemon #3: Daemon startup failed This should not happen under normal circumstances, please file an issue if it does. com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.0-5326820-windows Daemon #4: Daemon startup failed This should not happen under normal circumstances, please file an issue if it does. com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.0-5326820-windows Daemon #5: Daemon startup failed This should not happen under normal circumstances, please file an issue if it does. com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.0-5326820-windows Daemon #6: Daemon startup failed This should not happen under normal circumstances, please file an issue if it does. com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.0-5326820-windows Daemon #7: Daemon startup failed This should not happen under normal circumstances, please file an issue if it does.* Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.* Get more help at https://help.gradle.orgDeprecated Gradle features were used in this build, making it incompatible with Gradle 6.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/5.1.1/userguide/command_line_interface.html#sec:command_line_warningsBUILD FAILED in 23s

这是Build.gradle文件:
buildscript {repositories { maven { url 'https://maven.fabric.io/public' } }dependencies { // The Fabric Gradle plugin uses an open ended version to react // quickly to Android tooling updates classpath 'io.fabric.tools:gradle:1.+' } }plugins { id "com.onesignal.androidsdk.onesignal-gradle-plugin" version "0.12.1" }apply plugin: 'com.android.application' //Put Fabric plugin after Android plugin apply plugin: 'io.fabric' apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'repositories { maven { url 'https://maven.fabric.io/public' } } android { signingConfigs { config { keyAlias 'maker_key' keyPassword '!23342' storeFile file('E:/axita.savani/Android_Project/AppCred/maker_key.jks') storePassword '!23342' } } compileSdkVersion 28 buildToolsVersion '28.0.3' defaultConfig { applicationId "com.example.myapplication" minSdkVersion 17 targetSdkVersion 28 vectorDrawables.useSupportLibrary = true multiDexEnabled true ndk { abiFilters "armeabi-v7a", "x86", "arm64-v8a" } } buildTypes { debug { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android- optimize.txt'), 'proguard-rules.pro' zipAlignEnabled true shrinkResources false externalNativeBuild { ndkBuild { cFlags '-DDEBUG' } } } release { debuggable false minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android- optimize.txt'), 'proguard-rules.pro' zipAlignEnabled true shrinkResources true externalNativeBuild { ndkBuild { cFlags '-DRELEASE' } } } }sourceSets { main { res.srcDirs = [ 'src/main/res/layouts/activities', 'src/main/res/layouts/fragments', 'src/main/res/layouts/background', 'src/main/res/layouts/camera', 'src/main/res/layouts/sticker', 'src/main/res/layouts/text', 'src/main/res/layouts/editor', 'src/main/res/layouts/commom', 'src/main/res/layouts/other', 'src/main/res/layouts/videotrimmer', 'src/main/res/layouts/obgallarylib', 'src/main/res/layouts/template', 'src/main/res/layouts/eraser', 'src/main/res/layouts/user_guide', 'src/main/res/layouts/my_art', 'src/main/res/layouts/audio', 'src/main/res/layouts/video','src/main/res/layouts-land/activities', 'src/main/res/layouts-land/fragments', 'src/main/res/layouts-land/background', 'src/main/res/layouts-land/camera', 'src/main/res/layouts-land/sticker', 'src/main/res/layouts-land/text', 'src/main/res/layouts-land/editor', 'src/main/res/layouts-land/commom', 'src/main/res/layouts-land/other', 'src/main/res/layouts-land/my_art','src/main/res/layouts', 'src/main/res/layouts-land', 'src/main/res' ] } }android { aaptOptions { ignoreAssetsPattern "!*ffprobe" } dexOptions { jumboMode true } lintOptions { disable 'GoogleAppIndexingWarning' checkReleaseBuilds false // Or, if you prefer, you can continue to check for errors in release builds, // but continue the build even when errors are found: abortOnError false } }def flavorName = 'Maker' // todo change in flavorname which app is usedexternalNativeBuild { ndkBuild { path "src/${flavorName}/jni/Android.mk" } }flavorDimensions "default"product flavors {// ONE SIGNAL IDs Maker { applicationId "com.example.maker"versionCode 9 versionName "9.0" flavorDimensions "default" signingConfig signingConfigs.config setProperty("archivesBaseName", "Business_$versionName.$versionCode") }}packagingOptions { exclude 'META-INF/DEPENDENCIES.txt' exclude 'META-INF/DEPENDENCIES' exclude 'META-INF/dependencies.txt' exclude 'META-INF/LICENSE.txt' exclude 'META-INF/LICENSE' exclude 'META-INF/license.txt' exclude 'META-INF/LGPL2.1' exclude 'META-INF/NOTICE.txt' exclude 'META-INF/NOTICE' exclude 'META-INF/notice.txt' } compileOptions { sourceCompatibility 1.8 targetCompatibility 1.8 } }dependencies { /*TODO one Signal*/ implementation 'com.onesignal:OneSignal:3.10.6'implementation 'com.android.support:multidex:1.0.3' implementation 'com.android.support:appcompat-v7:28.0.0' //implementation 'com.android.support:customtabs:27.1.1' implementation 'com.android.support:recyclerview-v7:28.0.0' implementation 'com.android.support:cardview-v7:28.0.0' implementation 'com.android.support:design:28.0.0' //implementation 'com.android.support:palette-v7:27.1.1' implementation 'com.google.code.gson:gson:2.8.5' //implementation 'com.github.yalantis:ucrop:2.2.1' implementation 'com.github.yalantis:ucrop:2.2.2'//implementation 'com.kbeanie:multipicker:1.1.31@aar' //implementation project(path: ':multipicker')/*database Dislay From chorome used this */ implementation 'com.facebook.stetho:stetho:1.5.0'implementation 'com.github.bumptech.glide:glide:4.8.0' annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'/* Pinch zoom image */ //implementation 'com.davemorrissey.labs:subsampling-scale-image- view:3.6.0'implementation 'com.viewpagerindicator:library:2.4.1@aar'/*GIF Image View*/ implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.16'/* YOYO animation*/ implementation 'com.daimajia.easing:library:2.0@aar' implementation 'com.daimajia.androidanimations:library:2.3@aar'implementation 'com.codemybrainsout.rating:ratingdialog:1.0.8'/* FCM */ //implementation 'com.google.firebase:firebase-messaging:15.0.2' /* AdMob */ implementation 'com.google.firebase:firebase-ads:17.2.0'/* InAppPurchase */ implementation 'com.android.billingclient:billing:1.2'/* EU User Consent SDK */ implementation 'com.google.android.ads.consent:consent-library:1.0.7'//For Crash analytics implementation('com.crashlytics.sdk.android:crashlytics:2.9.7@aar') { transitive = true }implementation 'com.azeesoft.lib.colorpicker:colorpicker:1.0.9@aar' implementation 'com.h6ah4i.android.widget.verticalseekbar:verticalseekbar:0.7.2'implementation 'nl.bravobit:android-ffmpeg:1.1.5' implementation 'com.googlecode.mp4parser:isoparser:1.1.22' /*storage for path */ implementation 'com.snatik:storage:2.1.0' /*exo player for Audio and Video */ implementation 'com.devbrackets.android:exomedia:4.3.0'/*Download file From Server */ implementation 'com.mindorks.android:prdownloader:0.5.0'/*Ob Volly library*/ implementation 'com.optimumbrew.corelib:networking-volly:8.0.8' /*Audio picker library */ implementation 'com.optimumbrew.picker:audiopicker:1.1.17'/* Optimumbrew Image loader*/ implementation 'com.optimumbrew.obglide:obglide:2.0.2' /* inhouse ads library*/ implementation 'com.optimumbrew.obinhouseads:obinhouseads:11.0.11'implementation project(path: ':spacelib')/*Video Tools*/ implementation project(':video-record') implementation project(':video-compressor') implementation project(':video-effect')implementation 'com.daasuu:ExoPlayerFilter:0.2.3' implementation 'io.reactivex.rxjava2:rxandroid:2.0.1' implementation 'io.reactivex.rxjava2:rxjava:2.1.5' implementation 'com.tbruyelle.rxpermissions2:rxpermissions:0.9.4@aar'implementation 'com.jakewharton:butterknife:8.8.1' annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'//exo player note : Don't upgrade of exoplayer vesion implementation 'com.google.android.exoplayer:exoplayer:2.9.1'implementation 'com.android.volley:volley:1.1.1'} //apply plugin: 'com.google.gms.google-services' // Use for FCM Push

答案在Android Studio终端中使用./gradlew build --warning-mode all来获取更多信息。
首先要做的是Invalidate caches + restart。
另一答案【更新后Android Studio 3.3到3.4 AAPT2生成错误】请将build script {更改为buildscript {,不得有空格。它会工作。还尝试在“gradle-wrapper.properties”中使用distributionUrl=https://services.gradle.org/distributions/gradle-4.10.1-all.zip并再次同步

    推荐阅读