0

enter image description here

My app is having trouble building as when I try to build it it pops up with the error shown in the screen below. I have tried the putting the following in the gradle.properties file:

AAPT2.enabled=false
android.enableAapt2=false

but neither of these work in 3.3 as it says disabling aapt2 is deprecated and will be enabled anyway, kicking up the same error. I am looking for a long term solution preferably, but any suggestions will be deeply appreciated. Thanks in advance.

Zoe
  • 27,060
  • 21
  • 118
  • 148
CoderMuffin
  • 519
  • 1
  • 10
  • 21
  • ***Do not disable AAPT2!*** The behavior has been deprecated, and AAPT2 is the new standard. Instead, take a look at https://stackoverflow.com/q/48400895/6296561 and find the actual issue (Android Studio isn't the best at showing what the actual problem is), and create a [mcve] – Zoe Mar 24 '19 at 14:04
  • What task is it failing for? Did it build before? If so, what did you change? You didn't give us enough information to figure out what's going on. At the very least add the build log and the project level build.gradle. – Izabela Orlowska Mar 25 '19 at 11:27
  • this happened to me when updating `defaultCompileSdkVersion` so I put it back and viola – Jacksonkr Aug 23 '23 at 23:22

5 Answers5

1

This is how I fixed this issue for myself (Thanks to this Youtube video) In your Project level build.gradle file in Android studio: upgrade your gradle build tool like this:

Old:

    dependencies {
     classpath 'com.android.tools.build:gradle:3.3.2'
    
}

New:

    dependencies {

    classpath 'com.android.tools.build:gradle:3.4.0'
    
}
kc ochibili
  • 3,103
  • 2
  • 25
  • 25
1

In view of Jan2021 current situtation following version can be referred. In your Project build.gradle file downgrade dependecies to gradle 4.0.2 as below

dependencies {

        // for AAPT2 ERROR RESOLUTION
        classpath "com.android.tools.build:gradle:4.0.2"

    }
0

I am also facing this Error. Try to change the classpath in your Gradle file

dependencies {
    ....
    classpath 'com.android.tools.build:gradle:4.0.0'
}
Taslim Oseni
  • 6,086
  • 10
  • 44
  • 69
0
   I'm running my existing application on another system it shows this error
     aapt2 process unexpectedly exit. error output:

    here what i did 
   in android>build.gradel not in android>app>build.gradel
   change from   dependencies {
    classpath("com.android.tools.build:gradle:4.1.0")
    classpath('com.google.gms:google-services:4.3.3')
    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
   }
    change to 
     dependencies {
    classpath("com.android.tools.build:gradle:3.6.4")
    classpath('com.google.gms:google-services:4.3.4')
    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
     }
vibhu
  • 369
  • 3
  • 10
-3

If above dont work please disable anti virus. Smadav was blocking my rocket lauch

Yunat Amos
  • 93
  • 4