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

Long image filenames result in assembleRelease crash #16263

Closed
mjroeleveld opened this issue Oct 9, 2017 · 8 comments
Closed

Long image filenames result in assembleRelease crash #16263

mjroeleveld opened this issue Oct 9, 2017 · 8 comments
Labels
Bug 📮Known Issues This indicates an issue that refers to a bug or limitation of RN that is not currently being handled Platform: Android Android applications. Resolution: Locked This issue was locked by the bot.

Comments

@mjroeleveld
Copy link

Is this a bug report?

Yes

Have you read the Contributing Guidelines?

Yes

Environment

  1. react-native -v: 0.45.1
  2. node -v: v8.2.1
  3. npm -v: 5.3.0
  • Target Platform: Android

  • Development Operating System: macOS

  • Build tools:
    compileSdkVersion 23
    buildToolsVersion '25.0.0'

Steps to Reproduce

  1. Create a file in a deep folder (e.g. /shared/components/Component/components/AnotherComponent/components/AnotherComponent/components/AnotherComponent/img/image.png)
  2. Require that file
  3. Run assembleRelease

Expected Behavior

Successful assembly

Actual Behavior

Assembly fails when processing the file:

.../app/android/app/build/intermediates/res/merged/release/drawable-mdpi/shared_components_component_components_anothercomponent_components_anothercomponent_components_anothercomponent_img_image.png: error: Invalid filename.  Unable to add.

:app:processReleaseResources FAILED

FAILURE: Build failed with an exception.

It's probably the long filename that cannot be handled by Java. When I undeepen the structure, the problem disappears. If a hash of the path would be used as a filename, this problem would not exist.

Reproducible Demo

https://github.com/joachimroeleveld/rn-issue-15509

Steps to reproduce:

  1. clone repo
  2. npm install
  3. run ./android/assembleRelease
@rpavlovs
Copy link

Same issue:

.../mobile_node_modules_reactnative_libraries_customcomponents_navigationexperimental_assets_backicon.png
Invalid filename. Unable to add.

@vovanmozg
Copy link

vovanmozg commented Nov 7, 2017

The names of assets files converting at the getAndroidResourceIdentifier() method.

function getAndroidResourceIdentifier(asset: PackagerAsset) {

I suggest to modify getAndroidResourceIdentifier() method by drastically change filenames with using md5

function getAndroidResourceIdentifier(asset: PackagerAsset) {
  var folderPath = getBasePath(asset);
  return 'a' + md5(folderPath + '/' + asset.name).toLowerCase();
}

Return value should not begins from digit. For this at the beginning of the line the symbol 'a' (shortened from the 'assets')

@stale
Copy link

stale bot commented Jan 6, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. If you think this issue should definitely remain open, please let us know why. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Jan 6, 2018
@mjroeleveld
Copy link
Author

This should really not be closed as this is still a problem and it will affect more people in the future.

@stale stale bot removed the Stale There has been a lack of activity on this issue and it may be closed soon. label Jan 6, 2018
@stale
Copy link

stale bot commented May 16, 2018

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as "For Discussion" or "Good first issue" and I will leave it open. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label May 16, 2018
@stale stale bot removed the Stale There has been a lack of activity on this issue and it may be closed soon. label May 16, 2018
@alienfractal
Copy link

Hi this is the future and i confirm this is still an issue...

@mlazari
Copy link
Contributor

mlazari commented Oct 15, 2018

Related Android bug: https://issuetracker.google.com/issues/36953084 It looks like the resulting drawable file name should be no longer than 100 characters.

@kelset kelset added Platform: Android Android applications. 📮Known Issues This indicates an issue that refers to a bug or limitation of RN that is not currently being handled labels Dec 17, 2018
@hramos hramos removed the Bug Report label Feb 6, 2019
@Salakar
Copy link
Contributor

Salakar commented Apr 10, 2019

👋 hey all, thanks for the report and additional Android issue tracker details.

I'm going to close this issue as it's out of our control, but let's track this over on the Known Issues list instead.

Feel free to continue the conversation though if needed and update on the status of the Android issue tracker should anything change.

Thank you

@Salakar Salakar closed this as completed Apr 10, 2019
@facebook facebook locked as resolved and limited conversation to collaborators Apr 10, 2020
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Apr 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug 📮Known Issues This indicates an issue that refers to a bug or limitation of RN that is not currently being handled Platform: Android Android applications. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

9 participants