Change App Name In React Native

前端 未结 14 768
滥情空心
滥情空心 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 20:59

    If you are asking only for Android here is solution

    Modify displayName in /app.json file

    Modify app_name in android/app/src/main/res/values/strings.xml

    then Run these commands one by one

    cd android
    gradlew clean
    cd ..
    react-native run-android
    
    0 讨论(0)
  • 2020-12-22 21:00

    first of all create a whole backup of the project including node modules (in order to restore icons/phots ..etc in the future)

    1. Update name and displayName in app.json to the new name
    2. rename app folder the same as app name
    3. Delete ios/ and android/ directories
    4. delete ndoe modules
    5. update name in package.json (you must use new name for import & require() in your code. eg : import {x} from 'NewAppName/src/api')
    6. watchman watch-del-all
    7. rm -rf /tmp/haste-map-react-native-packager-*
    8. rm -rf /tmp/metro-bundler-cache-*
    9. restart pc
    10. sudo npm install
    11. react-native eject
    12. restore icons/images
    13. react-native link
    14. restart pc
    15. run app caution : you may have to setup things manually. in my case SplashScreen
    0 讨论(0)
  • 2020-12-22 21:01

    The generator does not override the strings.xml file located in android/app/src/main/res/values/, so you have to change the app_name variable manually

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

    For Android

    Modify displayName in app.json file

    Modify app_name in android/app/src/main/res/values/strings.xml

    then Run these commands one by one

    cd android
    ./gradlew clean
    cd ..
    react-native run-android
    

    For iOS

    Modify Display Name in Project target (General Tab)

    Select your application project as Host Application in Project target for testing (General Tab)

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

    The way I did this for android (hacky, but it works) is just changed the string app_name field in

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

    It will change the name of your installed android app to whatever you put as the value.

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

    for android android/app/src/main/res/values/strings.xml My Android App

    for ios Just open it in xCode select project tab general just rename it.

    0 讨论(0)
提交回复
热议问题