Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed for task ':app:processReleaseResources' Failed to execute aapt

Questions what I tried:

Gradle Build Failed For Task app:processReleaseResources
Failed to execute aapt


What I did:
I followed the React Native Generating Signed APK

But at the part of $ cd android && ./gradlew assembleRelease and I get the following error:

* What went wrong:
Execution failed for task ':app:processReleaseResources'.
> Failed to execute aapt

Full build log

This is not solved with this question: "Gradle Build Failed For Task app:processReleaseResources" for me.

This are the build tools versions is tried: (in the file: build.gradle)

buildToolsVersion "23.0.1" // Android SDK Build-Tools
buildToolsVersion "25.0.2" // Android SDK Build-Tools
buildToolsVersion "26.0.2" // Android SDK Build-Tools
buildToolsVersion "26.1.1" // Android Tools
buildToolsVersion "27.0.1" // Android SDK Platform-Tools
buildToolsVersion "27.0.3" // Android SDK Build-Tools

I have all the build tools versions installed from the Appearance & Behavior > System Settings > Android SDK page tab SDK Tools

The buildToolsVersion "26.1.1" // Android Tools Is the only one thats not giving me this error:

* What went wrong:
Execution failed for task ':app:processReleaseResources'.
> Failed to execute aapt

But the error is:

* What went wrong:
A problem occurred configuring project ':app'.
> Failed to find Build Tools revision 26.1.1

Therefore I found: Failed to find Build Tools revision 23.0.1
But that answer did not work.

$ android list sdk -a

Did not work and returned bash: android: command not found

PS I am a newbie at react-native

like image 964
TessavWalstijn Avatar asked Feb 28 '18 10:02

TessavWalstijn


1 Answers

The error in the build log is:

C:\Users\gebr\Documents\Flavour\openapp\svs_app\android\app\build\intermediates\res\merged\release\drawable-hdpi\node_modules_reactnavigation_src_views_assets_backicon.png: error: uncompiled PNG file passed as argument. Must be compiled first into .flat file.

It means that most likely you're using a plugin that tries to add files to the release merged resources folder. In Android Gradle Plugin AAPT2 is enabled by default and therefore the files in the merged folder are compiled by it (.flat files).
The owners of the plugin should update their code to first compile the resources using AAPT2 before putting them into the merged folder, or even better, pass them as a source-set input to the merge resources task (not compiled). I'd strongly suggest the second approach.
Until the owners of the plugin do that, you might use an older version of the gradle plugin (before 3.0) or use the most recent one with the flag android.enableAapt2=false.

like image 99
Izabela Orlowska Avatar answered Oct 09 '22 12:10

Izabela Orlowska