简体   繁体   English

Android Studio项目模块中的AAPT2错误

[英]AAPT2 error in project module in Android Studio

My project contains two modules namely admin and user. 我的项目包含两个模块,即admin和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: 在“ gradle-wrapper.properties”上,使用最新版本:

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

And on your "build.gradle" app file the same, the latest version: 与您的“ build.gradle”应用文件相同,最新版本:

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. 在将Android Studio升级到3.1.3版本后,我已经花了几个小时来寻找针对此AAPT2错误的解决方案。 It solved the issue. 它解决了问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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