The android package
React Native Mac package with Android APK
Enter the project and run the following code to generate the keystore file
keytool -genkeypair -v -keystore my-release-key.keystore -alias my-key-alias -keyalg RSA -keysize 2048 -validity 10000 My-release-key. keystore Signature name my-key-alias The signature alias validity period is 10000 daysCopy the code
Enter as prompted or press Enter to skip
You can see the new one in the current directorymy-release-key.keystore
File, move the file to the following directory:
Find the following properties in the Android /app/build.gradle file and add the corresponding keystore and password
Modify the installation package name: android/app/SRC/main/res/values/strings. The XML
Package command: Go to the Android folder and run./gradlew assembleRelease
It is recommended to add the command “build_android” to package.json: “CD android &&./gradlew assembleRelease”
Packaging complete apk path = = > android/app/build/outputs/apk/release /
The packaging process may encounter some plug-in versions that are too low. Here are some common solutions:
The react – native – picker: verifyReleaseResources node_module find folder react – native – picker/android/build. Gradle file
android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
defaultConfig {
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'}}}Copy the code
Configure project :react-native-picker WARNING: Configuration ‘compile’ is obsolete and has been replaced with ‘implementation’ and ‘API ‘. Node_module finds folder The react – native – picker/android/build. Gradle file
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.facebook.react:react-native:+'
}
Copy the code
Task: aliyun – oss – react – native: verifyReleaseResources FAILED node_module find folder Aliyun oss – react – native/android/build. Gradle file
android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
defaultConfig {
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
}
lintOptions {
abortOnError false}}Copy the code
Configure project :aliyun-oss-react-native WARNING: Configuration ‘compile’ is obsolete and has been replaced with ‘implementation’ and ‘api’.
Aliyun node_module find folder – oss – react – native android/build. Gradle file
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.facebook.react:react-native:+'
}
Copy the code
IOS packaging
You need to configure the authorization certificate and account login in Xcode for IOS packaging. After completing the configuration, perform the following operations:
Engineering construction Archive
- Select the pattern as build pattern
- xcode -> product -> Archive
Printing the installation package
- Xcode -> Window -> Organizer -> Distribute app -> Development -> next > App Framework (select all -> Next * 2 -> Export (generally packaged on the desktop)
Install package to cell phone – cell phone connected to computer
- xcode -> window -> devices and simulators
Just drag the IPA file to the following location