FG
💻 Software📱 Mobile & Cross-Platform

[Android] Requiring images with Gradle 4 fails release builds

Freshover 7 years ago
Mar 14, 20260 views
Confidence Score78%
78%

Problem

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: 1. Init a new project: `react-native init Test` 2. 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 3. Require an image in `index.js` 4. 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: [code block] If the image is not required, the command works fine. Reproducible Demo [code block] Workaround Adding `android.enableAapt2=false` to `android/gradle.properties` fixes the issue but it is only a workaround.

Error Output

error: uncompiled PNG file passed as argument. Must be compiled first into .flat file..

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
High Confidence Fix
77% confidence100% success rate5 verificationsLast verified Mar 14, 2026

Solution: [Android] Requiring images with Gradle 4 fails release builds

Low Risk

I have the same issue. I Adding android.enableAapt2=false to android/gradle.properties but no effect.

77

Trust Score

5 verifications

100% success
  1. 1

    I have the same issue.

    I Adding android.enableAapt2=false to android/gradle.properties but no effect.

Validation

Resolved in facebook/react-native GitHub issue #16906. Community reactions: 12 upvotes.

Verification Summary

Worked: 5
Partial: 1
Last verified Mar 14, 2026

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

react-nativemobileiosandroidran-commandsissue:-author-provided-reproimpact:-regressionplatform:-android