question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Package is not a valid resource name

See original GitHub issue

Having following issue when running command ./gradlew :app:assembleprodRelease with enableHermes: true. package.json is generated under folder android/app/build/generated/res/react/release/raw/ after execute command

Execution failed for task ':app:mergeProdReleaseResources'.
> 
android/app/build/generated/res/react/prod/release/raw/package.json: Error: package is not a valid resource name (reserved Java keyword)

There are 2 product flavors (stag and prod) for the project. Using below dependencies: package.json

"react-native": "^0.60.3",
"react-native-fbsdk": "1.0.0-rc.5"

Below is the hermes dependency added in android/app/build.gradle

dependencies {
    if (enableHermes) {
      def hermesPath = "../../node_modules/hermesvm/android/";
      debugImplementation files(hermesPath + "hermes-debug.aar")
      releaseImplementation files(hermesPath + "hermes-release.aar")
      stagImplementation files(hermesPath + "hermes-release.aar")
      prodImplementation files(hermesPath + "hermes-release.aar")
    } else {
      implementation jscFlavor
    }
}

Same error when running command react-native run-android --variant prodRelease --appId <appId> --main-activity MainActivity

Even clean android/build folder using command ./gradlew :app:clean, issue still persist. Is there any other way to fix this error?

Any help would be very appreciated.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:14 (1 by maintainers)

github_iconTop GitHub Comments

22reactions
sbvorpagelcommented, Aug 7, 2019

@crispywong Why don’t import the package.json in the app? I’m using this to show the version in the app. Is this a bad practice?

17reactions
honeyp0tcommented, Sep 27, 2019

I imported package-lock.json instead of package.json, seems to work fine, fuck the police

Read more comments on GitHub >

github_iconTop Results From Across the Web

mergeReleaseResources Failed, caused of `not valid ...
The easiest way to solve this problem is to update to react-native 0.61.x . The whole solution can be found here.
Read more >
FileResourceNameValidator.java - android Git repositories
@param file the file resource to validate. * @param resourceType the resource type. * @throws MergingException is the resource name is not valid....
Read more >
Resources | Android Developers
Return the package name for a given resource identifier. ... This denotes an invalid resource ID that is returned by the system when...
Read more >
'L' is not a valid file based resource name character - YouTube
Hi Hello friends 'L' is not a valid file-based resource name character: File-based resource names must contain only lowercase a-z, 0-9, ...
Read more >
Error: ':' is not a valid resource name character - YouTube
SOLUTION: File Based Name Character Error | Error: ':' is not a valid resource name character#androidstudio #solution #errorfixed Error in ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found