Skip to content

[Android] possible regression with :app:mergeReleaseResources in 0.60.0-rc.1 #25325

Closed
@robertying

Description

@robertying

Problems

Those problems were introduced in 0.60.0-rc:

  1. import packageJson from './package.json' causes error

    Execution failed for task ':app:mergeReleaseResources'.
    > /Users/rying/repos/resourcesRepro/android/app/src/main/res/raw/package.json: Error: package is not a valid resource name (reserved Java keyword)
    

    Apparently package.json got copied to res/raw which makes gradle complain. This works fine in 0.59.x, however.

  2. All those generated resources (e.g. package.json, app.json...) get moved to android/app/src/main/res.

    • I believe those generated resources should not be moved into this directory since they are generated on the fly. The current behavior in 0.60.0-rc makes it difficult for Git version control - they should always in build rather than src.
    • Because of this, metro will also complain:
       jest-haste-map: Haste module naming collision: myapp
         The following files share their name; please adjust your hasteImpl:
           * <rootDir>/package.json
           * <rootDir>/android/app/src/main/res/raw/package.json
      
      I need to add those files into metro's blacklist to stop this error. ;(

Possible relevant commits

React Native version:

  System:
    OS: macOS 10.14.5
    CPU: (4) x64 Intel(R) Core(TM) i3-8100B CPU @ 3.60GHz
    Memory: 194.87 MB / 8.00 GB
    Shell: 5.7.1 - /usr/local/bin/zsh
  Binaries:
    Node: 12.4.0 - /usr/local/Cellar/node/12.4.0/bin/node
    Yarn: 1.16.0 - /usr/local/Cellar/node/12.4.0/bin/yarn
    npm: 6.9.0 - /usr/local/Cellar/node/12.4.0/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
  IDEs:
    Android Studio: 3.4 AI-183.6156.11.34.5522156
    Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.8.6 => 16.8.6 
    react-native: 0.60.0-rc.1 => 0.60.0-rc.1

Steps To Reproduce

  1. Clone https://github.com/robertying/resources-repro
  2. yarn
  3. react-native run-android --variant release

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugImpact: RegressionDescribes a behavior that used to work on a prior release, but stopped working recently.Platform: AndroidAndroid applications.Resolution: LockedThis issue was locked by the bot.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions