Change App Name In React Native

前端 未结 14 769
滥情空心
滥情空心 2020-12-22 20:29

I\'m trying to figure out how to change a ReactNative app name. The installed APK on my device is simply \"App\", with the Android icon. How can I change this?

I\'ve

相关标签:
14条回答
  • 2020-12-22 21:07

    before changing the app name get your code's backup and then , Go to following path in and replace your app name with new app name and change i one more file app.json E:***\android\app\src\main\res\values\strings.xml

    <resources>
        <string name="app_name">New Name</string>
    </resources>
    

    app.json

    {
      "name": "oldName",
      "displayName": "New Name"
    }
    
    0 讨论(0)
  • 2020-12-22 21:10

    Simply way

    PROJECT >android > app > main > res > style

    Then change the app name

    0 讨论(0)
  • 2020-12-22 21:13

    I find that, if you want to change both the app name and the package name (i.e. rename the entire app), the following steps are necessary:

    • Make sure you don't have anything precious (non-generated, manually copied resources) in the android/ and ios/ subfolders.

    • Delete both the android/ and ios/ folder.

    • Change the "name" entry in your package.json to the new name.

    • Change the app name in both your index.android.js and index.ios.js: AppRegistry.registerComponent('NewAppName', () => App);

    • Run react-native upgrade to re-generate the platform subfolders.

    • If you have linked resources (like custom fonts etc.) run react-native link.

    • If you have other generated resources (like app icons) run the scripts to generate them (e.g. yo).

    • Finally, uninstall the old app on each device and run the new one.

    0 讨论(0)
  • 2020-12-22 21:15

    simply change <string name="app_name"> 'NEW_APP_NAME' </string> located in

    [project_dir]/android/app/src/main/res/values/strings.xml

    NOTE: recommended

    react-native-rename

    by Paul Nyondo maybe affect MainApplication.java file, DON'T USE IT!

    0 讨论(0)
  • 2020-12-22 21:17

    You can try this

    1. Update displayName in app.json to the new name
    2. Delete ios/ and android/ directories
    3. Run react-native eject
    4. Run react-native link
    0 讨论(0)
  • 2020-12-22 21:18

    Try react-native-rename this npm package will ease the process

    This package assumes that you created your react-native project 
    using react-native init.
    

    Note: This package does not attempt to properly rename build artifacts such as ios/build or Cocoa Pod installation targets. After renaming your project you should clean, build, and reinstall third party dependencies to get it running properly with the new name.

    // in project directory
    
       npx react-native-rename <newName>
    
    0 讨论(0)
提交回复
热议问题