Yes
Yes
Environment:
OS: Linux 4.10
Node: 6.10.3
Yarn: 1.1.0
npm: 3.10.10
Watchman: 4.7.0
Error: unable to print environment info
{ Error: not found: xcodebuild
(snip stacktrace)
react-native init MyProject --version 0.48.3com.myproject package / applicationId to com.my.new.project according to this SO answer: https://stackoverflow.com/a/37390022/543864react-native-git-upgrade to upgrade to 0.49.1 (or higher) which failes silently like described in #12112There is a similar issue #11163 from when MainApplication.java was introduced in 0.29.
Running react-native-git-upgrade in step 3 uses the current Android package name by either parsing AndroidManifest.xml or accepting the package name as a param (ie. react-native-git-upgrade --package com.my.new.project and patches MainApplication.java in the correct path (ie. com/my/new/project).
It looks like react-native init took a package param in version 0.38 which was later removed. That code could be used as a basis for either a --package option to react-native-git-upgrade or parsing AndroidManifest.xml. What is the best approach?
Running react-native-git-upgrade in step 3 fails silently like described in #12112 because it tried to patch a file that is not in the git index. It tried to patch com/myproject/MainApplication.java instead of com/my/new/project/MainApplication.java.
Follow the steps under Steps to Reproduce.
I just ran into this same issue. I had to rename my android package to make react-native-git-upgrade happy, do the upgrade, then rename it back. Not a recommended solution.
Same issue here, attempted a manual upgrade and having some troubles. Will try @richardgirges's workaround.
My workaround (this time) was to copy my existing MainApplication.java to the path react-native-git-upgrade expects, run the upgrade and then copy the file back to the correct path.
yeah... @nikolaik's workaround worked for me. Not sure where react-native-git-upgrade is getting the old package name from. I couldn't find any references to the old name of my package anywhere in my code
I'm experiencing the same issue as I changed my Android package name to be in the form com.companyname.appname instead of the default form com.appname that react-native init generates.
@SirNeuman react-native-git-upgrade gets the package name by looking at the name value in your package.json. It assumes that this matches the name of your app, and then it also assumes that your Android package name is still in the form that it was when the project was generated, i.e. com.appname.
It seems like it should be possible to update react-native-git-upgrade so that it is able to figure out your actual package name; it could just pull this from your android/app/src/main/AndroidManifest.xml file since the location of that file does not change (unlike the location of the MainApplication.java file) and the manifest node has a package attribute with the correct value of the Android package name.
In the meantime, I was also able to use the workaround posted by @nikolaik.
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.
This will keep affecting people for every update of the MainApplication.java template file. I like @jordanmkoncz 's approach.
Yeah this issue should definitely remain open. It seems like it should be fairly easy/straightforward to fix (at least with my suggested solution of inspecting android/app/src/main/AndroidManifest.xml) and would save people from having to do these annoying workarounds every time they upgrade React Native.
Is there a place someone could submit a PR to try to fix this issue?
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.
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.
Most helpful comment
My workaround (this time) was to copy my existing MainApplication.java to the path react-native-git-upgrade expects, run the upgrade and then copy the file back to the correct path.