简体   繁体   中英

AAPT2 error in project module in Android Studio

My project contains two modules namely admin and user. The user module works without any error however the admin module throws compile time error as follows:

error: style attribute '@android:attr/attr/gravity' not found.
error: style attribute 'attr/@attr/minTextSize (aka com.ict.school.admin:attr/@attr/minTextSize)' not found.
    first 
     in gradle.properties add code below
    android.enableAapt2=false


    second:
    A new version of Gradle and Android-gradle-plugin is available that fixes these issues.
add this in app geadle:

    buildscript {
        dependencies {
            classpath 'com.android.tools.build:gradle:3.2.0-alpha17'
        }
    }

and after that in gradle-wrapper.properties change distributionUrl:

    distributionUrl=https\://services.gradle.org/distributions/gradle-4.8-all.zip

On "gradle-wrapper.properties" use the latest version:

distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-all.zip

And on your "build.gradle" app file the same, the latest version:

dependencies {
        classpath 'com.android.tools.build:gradle:3.3.0-alpha03'
        classpath 'com.google.gms:google-services:4.0.2'
    }

I've been several hours looking for a solution to this AAPT2 Error after upgrading Android Studio to the 3.1.3 version. It solved the issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM