Skip to content

Long image filenames result in assembleRelease crash #16263

@mjroeleveld

Description

@mjroeleveld

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugPlatform: AndroidAndroid applications.Resolution: LockedThis issue was locked by the bot.📮Known IssuesThis indicates an issue that refers to a bug or limitation of RN that is not currently being handled

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions