react-native 修改包名
修改android包名
首先找个相关的几个文件
android/app/src/main/AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.homestay"> 改为 package="cn.mayeve.homestay"
android/app/build.gradle
defaultConfig { applicationId "com.homestay" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 1 versionName "1.0" } 改为 applicationId "cn.mayeve.homestay"
android/app/BUCK
android_build_config( name = "build_config", package = "com.homestay", ) android_resource( name = "res", package = "com.homestay", res = "src/main/res", ) 改为: package = "cn.mayeve.homestay"
- 修改类的
package
:
用idea打开android; 选择需要修改的包,右键 -> refactor -> remove -> 填写to package 为 cn.mayeve.homestay -> refactor;
- 修改
MainApplication.java
修改 ‘BuildConfig’ 类的引入
RN 修改ios包名:(以X-code 10.2.1为例,xcode版本不同略有差异)
用 X-code
打开项目根目录,点击 General
即可看到 Identity
栏目
Display Name -> 智能民宿 (此处为App名称) Bundle Identifier -> cn.mayeve.homestay (此处为包名)