-
Notifications
You must be signed in to change notification settings - Fork 24.8k
Description
Hello guys,
I ran into this issue when updating Gradle and Android Studio.
Thanks for your help!
Is this a bug report?
Yes
Have you read the Contributing Guidelines?
Yes
Environment
Environment:
OS: macOS Sierra 10.12.6
Node: 8.5.0
Yarn: 1.3.2
npm: 5.3.0
Watchman: 4.7.0
Xcode: Xcode 9.1 Build version 9B55
Android Studio: 3.0 AI-171.4408382
Packages: (wanted => installed)
react: 16.0.0 => 16.0.0
react-native: 0.50.3 => 0.50.3
Target Platform: Android (22)
Steps to Reproduce
Requiring images with latest gradle
fails release builds
I created a small test project but here are the steps to reproduce it:
- Init a new project:
react-native init Test
- Update to latest Gradle:
- Open Android Studio and install recommended version
- Build from Android Studio, it should ask you to update build tools, do so
- Require an image in
index.js
- Run
cd android && ./gradlew assembleRelease
Expected Behavior
The command ./gradlew assembleRelease
should not fail
Actual Behavior
Running ./gradlew assembleRelease
when the image is required from the JS fails with:
/Users/almouro/bam/uefa/TestGradle3/android/app/build/intermediates/res/merged/release/drawable-mdpi/image.png: error: uncompiled PNG file passed as argument. Must be compiled first into .flat file..
error: failed parsing overlays.
If the image is not required, the command works fine.
Reproducible Demo
git clone https://github.com/Almouro/react-native-with-gradle-4
yarn
cd android
./gradlew assembleRelease
Workaround
Adding android.enableAapt2=false
to android/gradle.properties
fixes the issue but it is only a workaround.