Skip to content

Conversation

@lnikkila
Copy link
Contributor

Rationale from the commit message:

Some Android projects might opt to use multiple manifest files, e.g. for
choosing different permissions based on the build type. Android's build
process merges the manifests; secondary manifests can omit everything
present in the main manifest. We shouldn’t rely on those secondary
manifests for information since crucial information like the package
name might not be present.

The story is that I was using multiple manifests and trying to run react-native link to link some libraries, that specific command kept failing with:

rnpm-install ERR! ERRPACKAGEJSON No package found. Are you sure it's a React Native project?

Turns out it couldn’t find the package name from the manifest since it was looking into the debug build type’s manifest that didn’t have it.

Links for reference:

Please let me know if you need more info or if anything needs to be changed. Thanks!

Some Android projects might opt to use multiple manifest files, e.g. for
choosing different permissions based on the build type. Android's build
process merges the manifests; secondary manifests can omit everything
present in the main manifest. We shouldn’t rely on those secondary
manifests for information since crucial information like the package
name might not be present.
@ghost
Copy link

ghost commented Sep 23, 2016

By analyzing the blame information on this pull request, we identified @grabbou to be a potential reviewer.

@ghost
Copy link

ghost commented Sep 23, 2016

Thank you for your pull request. As you may know, we require contributors to sign our Contributor License Agreement, and we don't seem to have you on file and listed as active anymore. In order for us to review and merge your code, please email [email protected] with your details so we can update your status.

@ghost ghost added GH Review: review-needed CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. labels Sep 23, 2016
@ghost
Copy link

ghost commented Sep 23, 2016

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@lnikkila
Copy link
Contributor Author

lnikkila commented Sep 23, 2016

Looks like the E2E tests are failing since bdc4731 in master.

@facebook-github-bot
Copy link
Contributor

It's been a while since the last commit was reviewed and the labels show this pull request needs review. Based on the blame information for the files in this pull request we identified @grabbou as a potential reviewer. Could you take a look please or cc someone with more context?

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 23, 2016
@grabbou
Copy link
Contributor

grabbou commented Oct 24, 2016

Thanks for the PR! That addition looks interesting though I think it's a bit too much specific to your app needs. I mean - there's nothing wrong with that, but we would like to keep a balance of what CLI can do vs what we can maintain and test really well.

To make your requested changes still working, how about making manifestPath configurable through the config, as the rest of the properties?

Just replace https://github.com/lnikkila/react-native/blob/4273b48c34d334c9449462bce9a54c40b2585857/local-cli/core/config/android/index.js#L24

const manifestPath = findManifest(sourceDir);

with

const manifestPath = userConfig.manifestPath
   ? path.join(sourceDir, userConfig.manifestPath)
   : findManifest(sourceDir)

and you should be able to specify a path to your valid Manifest (if you have more than one)

PS. Don't forget to do the same for dependencyConfig! Your tests are ok :)

@lacker
Copy link
Contributor

lacker commented Dec 14, 2016

Hey, thanks everyone for contributing here. It seems like this pull request has been abandoned so I am going to close it. If you would like to work on this more then please feel free to reopen it!

@lacker lacker closed this Dec 14, 2016
facebook-github-bot pushed a commit that referenced this pull request Jun 6, 2017
Summary:
`react-native link` often fails due to the wrong manifest being used when you use a debug manifest. `findManifest` returns `debug/AndroidManifest.xml` instead of `main/AndroidManifest.xml`. And the debug manifest usually does not have the package name defined so `projectConfigAndroid` throws a cryptic "Cannot read property 'replace' of undefined" error.

This fixes the issue by throwing a more user friendly error and providing a `manifestPath` userConfig.

This is mostly based on comments to #10050.
Closes #13373

Differential Revision: D4945690

Pulled By: shergin

fbshipit-source-id: b177f916fd4799c873d2515c18cbb87bef3203f0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants