Skip to content

react-native-git-upgrade does not respect android package name #16217

@nikolaik

Description

@nikolaik

Is this a bug report?

Yes

Have you read the Contributing Guidelines?

Yes

Environment

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)

Steps to Reproduce

  1. Run react-native init MyProject --version 0.48.3
  2. Rename your com.myproject package / applicationId to com.my.new.project according to this SO answer: https://stackoverflow.com/a/37390022/543864
  3. Run react-native-git-upgrade to upgrade to 0.49.1 (or higher) which failes silently like described in react-native-git-upgrade changes nothing #12112

There is a similar issue #11163 from when MainApplication.java was introduced in 0.29.

Expected Behavior

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?

Actual Behavior

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.

Reproducible Demo

Follow the steps under Steps to Reproduce.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Platform: AndroidAndroid applications.Ran CommandsOne of our bots successfully processed a command.StaleThere has been a lack of activity on this issue and it may be closed soon.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions