Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android prod release - gradle tools 3 error #3097

Closed
kelset opened this issue Dec 9, 2017 · 7 comments
Closed

Android prod release - gradle tools 3 error #3097

kelset opened this issue Dec 9, 2017 · 7 comments
Labels

Comments

@kelset
Copy link

kelset commented Dec 9, 2017

This is basically a "reload" of issue #1976 because it became polluted and hard to follow.

Current Behavior

When using Android Studio 3.0, gradle 4.1 & gradle tools 3.0.0 (build tools 26.0.2) (or higher), creating a production release is impossible because of this error:

uncompiled PNG file passed as argument. Must be compiled first into a .flat file.. error: failed parsing overlays.

Which is it's caused by the asset files that gets bundled, like: node_modules_reactnavigation_src_views_assets_backicon.png

It's clearly related to AAPT2, the new version present in gradle tools 3.0 - but even the migration guide doesn't seem to offer an explanation for this kind of error. This SO answer seems to provide some more details but, yeah, until better explanations here are some workarounds:

Expected Behavior

That everything gets bundled properly with AAPT2.

Your Environment

As already stated, Android Studio 3.0, gradle 4.1 & gradle tools 3.0.0 (build tools 26.0.2). Doesn't look like it's related to rn/navigation versions, but still happens with latest:

software version
react-navigation beta.21
react-native 0.51
node 8.9.x
yarn 1.3.2
@hiddentao
Copy link

As stated in #1976 the following temporary workaround got things moving again for me:

// gradle.properties

android.enableAapt2=false

I'm using Android Studio 3.0.1 on OS X, Gradle 4.1, Build tools 26.0.2

@wmonecke
Copy link

wmonecke commented Jan 16, 2018

Still facing this issue here. Any updates / fix on this?

I tried adding the workaround and now get confronted by this error:

node_modules_reactnativerouterflux_node_modules_reactnavigation_src_views_assets_backicon.png: error: Duplicate file.

...
Loading dependency graph, done.
warning: the transform cache was reset.
bundle: start
bundle: finish
bundle: Writing bundle output to: /Users/waltermonecke/Code_Projects/reactNative/lisdo/android/app/build/intermediates/assets/release/index.android.bundle
bundle: Done writing bundle output
bundle: Copying 106 asset files
bundle: Done copying assets

/Users/waltermonecke/Code_Projects/reactNative/lisdo/android/app/build/intermediates/res/merged/release/drawable-hdpi-v4/node_modules_reactnativerouterflux_node_modules_reactnavigation_src_views_assets_backicon.png: error: Duplicate file.

UPDATE: This specific error can be handled by deleting all images from:

'android/app/src/main/res/drawable-mdpi'
'android/app/src/main/res/drawable-hdpi'
'android/app/src/main/res/drawable-xhdpi'
'android/app/src/main/res/drawable-xxhdpi'
'android/app/src/main/res/drawable-xxxhdpi'

(Thanks @sujayjaju)

@otoinsa
Copy link

otoinsa commented Jan 17, 2018

For me deleting all images did not help,
setting android.enableAapt2=false and syncing gradle did however.

It's not a fix,
but a workaround. :(

@adsellor
Copy link

Any updates on this? I tried to set android.enableAapt2=false but it didn't help, as well as cleaning assets from all drawable-* folders

@p-ugulino
Copy link

@adsellor I also did ./gradlew clean to get it working.

@brentvatne
Copy link
Member

this is an upstream issue facebook/react-native#16906

@IgorGanapolsky
Copy link

I too was facing this issue, even after placing android.enableAapt2=false in my gradle.properties file. The only thing that fixed it is manually deleting all the build folders in my project, and reassembling.

@react-navigation react-navigation locked as resolved and limited conversation to collaborators Feb 8, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

8 participants