Change package name for Android in React Native

后端 未结 20 1854
鱼传尺愫
鱼传尺愫 2020-11-30 16:13

I used react-native init MyApp to initialise a new React Native app. This created among others an Android project with the package com.myapp.

20条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-30 16:46

    you can simply use react-native-rename npm package.

    Install using

    npm install react-native-rename -g

    Then from the root of your React Native project execute the following

    react-native-rename "MyApp" -b com.mycompany.myapp

    react-native-rename on npm

    but notice that, this lib remove your MainActivity.java and MainApplication.java. before changing your package name, give a backup from this two file and, after changing package name just put it back to their place. this solution work for me

    more info: react-native-rename

提交回复
热议问题