如何修复 AAPT2 警告 [已弃用并删除以下项目选项:Android Studio 3.3 中的 android.enableAapt2]

How to fix AAPT2 warning [The following project options are deprecated and have been removed: android.enableAapt2] in Android Studio 3.3

当我构建 App 时。在将 Android Studio 版本 更新为 3.3 并更新 gadler 插件等后,我得到 警告 .

这是我的build.gradle(模块:App)

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.jirin.kollinapp"
    minSdkVersion 19
    targetSdkVersion 28
    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(include: ['*.jar'], dir: 'libs')
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
}

gradle.properties

org.gradle.jvmargs=-Xmx1536m
android.enableAapt2=false

似乎 AAPT2 默认启用 Gradle 3+。

确保更新到 Gradle 3.3.0。然后做一个清洁。

警告只是告诉您从 gradle.properties 中删除 android.enableAapt2=false