I am usingandroid.enableAapt2 = false
in my gradle.properties
file. After updating android studio to 3.1 my project showing a warning to update or
Update the project gradle dependencies. The code is below.
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Ensure that all your res
resources are of a valid type. In my case I had a .mov file in my res/raw
directory.
When upgrading Gradle and starting to use Aapt2 I also got some similar errors building the project. In my case the problem was in a drawable resource file that required a higher API version as it was my minSdkVersion set in build.gradle. The main problem was that file did not show any error until you opened it, so it was hard to find it at all. I have spent at least 4 hours trying other things, since as an error when building the project it showed another drawable resource (as not found) files that did not have any problems at all. After removing the drawable that required the higher API the app built normally.
Gradle 4.4, com.android.tools.build:gradle:3.1.4, Android studio: 3.1.4
I Solved this issue going in gradle build file (build.gradle) in line: "classpath 'com.android.tools.build:gradle:3.1.0'" this is the latest version in Android Studio 3.1
change this line: "classpath 'com.android.tools.build:gradle:3.1.0'" to : "classpath 'com.android.tools.build:gradle:3.0.0'" and add "android.enableAapt2=false" in gradle.properties.
the Android Studio going to install all dependencies automotically and you be able to compile the application normally
obs: forgive my poor english
Finally, I have fixed the issue by updating android gradle plugin to alpha version.
Update your android gradle plugin in your project level build.gradle file like below:
classpath 'com.android.tools.build:gradle:3.2.0-alpha13'
Now update android.enableAapt2=true
. Then check and build your project. Issue will be resolved.