user8887068
user8887068

Reputation:

How to rename project react native

I'm trying to rename a React Native boilerplate to myApp. I'm following this renaming guide as instructed by the boilerplate repo, doing the following after running npm install in the cloned project:

  1. Change displayName in app.json
  2. Delete ios/ and android/ directories, run react-native eject
  3. Run react-native link

However, when I try to run the app with react-native run-android, I get the error:

Application myApp has not been registered

What am I doing wrong? This is pretty much the same question as Renaming react native example app, but there hasn't been an accepted answer (I've tried the given one, changing the name in package.json and running react-native upgrade to no avail)

Edit: I did some more testing, and I found that whenever I delete /android and /ios, and react-native eject, I get the same error. So the issue is not specific to renaming the app, but the eject.

Upvotes: 4

Views: 5669

Answers (3)

Gattu
Gattu

Reputation: 133

if you want to to rename your project name then follow this step:

1] open file file location:

android/app/src/main/res/values/strings.xml

2] change here to add your wanted project name:

<resources>
    <string name="app_name">LoanApp</string><---hehe LoanApp name to change your project name 
</resources>

Upvotes: 0

IftekharDani
IftekharDani

Reputation: 3729

Below steps may help you to rename project:

Tested on my machine

Step 1: git clone https://github.com/AmitM30/react-native-typescript-boilerplate.git
Step 2: sudo npm install -g react-native-rename
Step 3: cd react-native-typescript-boilerplate/
Step 4: npm install
Step 5: react-native-rename “Name of the app which you want to do”
Step 6: watchman watch-del-all
Step 7: npm start --reset-cache
Step 8: react-native run-ios (For Running IOS app in IOS emulator)
Step 9: react-native run-android (For Running Android app in Android emulator)

Upvotes: 0

fdelafuente
fdelafuente

Reputation: 1122

Maybe this can help you react-native-rename, it's pretty easy to use

steps:

  • react-native-rename "New Name"
  • react-native run-android -- --reset-cache

to change package name (only for android) do

react-native-rename "New Name" -b com.company.appname

Upvotes: 5

Related Questions