Adnroid:
-
修改App的名称:
Project/android/app/src/res/values/strings.xml
<resources>
<string name="app_name">Your App Name</string>
</resources>
-
修改App的图标:
Project/android/app/sec/main/res/mipmap…dpi/ic_launcher.png
默认四个,需替换对应尺寸的App Icon
(若图标修改无效,卸载手机此App,删掉文件夹android/build和android/app/build,重新打包)
-
修改App的启动图:
Project/android/app/sec/main/res/mipmap…dpi/background.png
替换四个文件夹的background.png (
附
:react-native启动白屏优化 ios&android) -
修改App的包名、版本号:
//两个java文件
Project/android/app/src/main/java/com/.../MainActivity.java
first line: package com.xxx.myProject; //包名
Project/android/app/src/main/java/com/.../MainApplication.java
first line: package com.xxx.myProject; //包名
//android描述文件
Project/android/app/src/main/AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.xxx.myProject" //包名
android:versionCode="1"
android:versionName="0.0.1"
>
...
</manifest>
//两个打包脚本
Project/android/app/build.gradle
android {
compileSdkVersion 24
buildToolsVersion "24.0.1" //android编译系统
defaultConfig {
applicationId "com.xxx.myProject" //包名
minSdkVersion 16
targetSdkVersion 24
versionCode 1
versionName "0.0.1" //包版本号
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
}
Project/android/app/BUCK
android_build_config(
name = 'build_config',
package = 'com.xxx.myProject',
)
android_resource(
name = 'res',
res = 'src/main/res',
package = 'com.xxx.myProject',
)
Project/android/app/build/generated/source/buildConfig/.../BuildConfig.java
//Android Studio 编译完成
package com.xxx.myProject;
public final class BuildConfig {
public static final boolean DEBUG = Boolean.parseBoolean("true");
public static final String APPLICATION_ID = "com.xxx.myProject";
public static final String BUILD_TYPE = "debug";
public static final String FLAVOR = "";
public static final int VERSION_CODE = 1;
public static final String VERSION_NAME = "0.0.1";
}
-
修改App打包APK-name:
Project/android/app/build.gradle
android {
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
def versionCodes = ["armeabi-v7a":1, "x86":2]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
def outputFile = output.outputFile
if (outputFile != null && outputFile.name.endsWith('.apk')) {
def fileName = "xxx.apk" // APK 名
output.outputFile = new File(outputFile.parent, fileName)
}
}
}
}
-
替换google-services.json:
Project/android/app/google-services.json