1.發(fā)布android.apk
原生打包方式為 :Android Studio 找到Build -> Generate Signed APK...
rn需要用命令行方式
cd android && ./gradlew assembleRelease
2.發(fā)布ios.ipa
選擇release

3.android的VersionCode和VersionName
Google為APK定義了兩個(gè)關(guān)于版本屬性:VersionCode和VersionName,他們有不同的用途。
- VersionCode:對(duì)消費(fèi)者不可見(jiàn),僅用于應(yīng)用市場(chǎng)、程序內(nèi)部識(shí)別版本,判斷新舊等用途。
- VersionName:展示給消費(fèi)者,消費(fèi)者會(huì)通過(guò)它認(rèn)知自己安裝的版本,下文提到的版本號(hào)都是說(shuō)VersionName。
4.ios Xcode上Version和Build
- Version(應(yīng)用程序發(fā)布版本號(hào))
- Build(應(yīng)用程序內(nèi)部標(biāo)示)
參考鏈接
https://developer.android.google.cn/about/versions/nougat/android-7.0.html#apk_signature_v2
iOS開(kāi)發(fā)-Xcode Debug、Release、Archive、Profile、Analyze概念解釋
5.android studio 使用命令行打包的時(shí)候出現(xiàn) bash gradle command not found
mac 下的 bash gradle command not found
6.Android Studio之bash: gradlew: command not found
Android Studio之bash: gradlew: command not found
7.Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get m
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get m
8.android studio 3.0 運(yùn)行react-native-update失敗
Error:Execution failed for task ':react-native-update:compileDebugNdk'.
> Error: Your project contains C++ files but it is not using a supported native build system.
Consider using CMake or ndk-build integration. For more information, go to:
https://d.android.com/r/studio-ui/add-native-code.html
Alternatively, you can use the experimental plugin:
https://developer.android.com/r/tools/experimental-plugin.html
在項(xiàng)目的gradle.properties文件中加入這句
android.useDeprecatedNdk=true
在你導(dǎo)入的包含jni的庫(kù)的build.gradle文件中加入這句
sourceSets.main {
jni.srcDirs = []
}
參考鏈接
9.android 編譯
Native module UpdateModule tried to override UpdateModule for module name RCTHotUpdate. If this was your intention, set canOverrideExistingModule=true
刪除MainApplication.java下重復(fù)的包
- Xcode 打包的時(shí)候提示: select a method for export
1).Save for iOS App Store Deployment
上傳App Store 或者在越獄的iOS設(shè)備上使用
2).Save for Ad Hoc Deployment
證書(shū)包含udid 的設(shè)備使用
3).Save for Enterprise Deployment
針對(duì)企業(yè)級(jí)賬戶
40.Save for Development Deployment
內(nèi)部測(cè)試使用,證書(shū)包含udid 的設(shè)備使用
fir.im只支持 AdHoc 或 InHouse打包
11.Android 編譯修改打包Apk文件名
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
}
//Android 修改打包文件名
variant.outputs.all {
outputFileName = "app-${variant.name}-${variant.versionName}.apk"
}
}
}
還可以加入時(shí)間
def releaseTime() {
return new Date().format("yyyy-MM-dd_HH:mm", TimeZone.getDefault())
}
渠道
flavorDimensions "default"
productFlavors {
qihu360 {dimension "default"} // 360手機(jī)助手
yingyongbao {dimension "default"} // 騰訊應(yīng)用寶
fir_im {dimension "default"} // 豌豆莢
}
加入渠道的方式只適用于原始,在rn中使用編譯會(huì)出現(xiàn)請(qǐng)問(wèn)難題
variant.outputs.all {
outputFileName = "app-${variant.name}-${variant.versionName}(${variant.versionCode})-${releaseTime()}.apk"
}
參考鏈接
12.XCode打開(kāi)Archive界面
window ->organizer
Tunes Store Operation Failed
ERROR ITMS-90096: "Your binary is not optimized for iPhone 5 - New iPhone apps and app updates submitted must support the 4-inch display on iPhone 5 and must include a launch image referenced in the Info.plist under UILaunchImages with a UILaunchImageSize value set to {320, 568}. Launch images must be PNG files and located at the top-level of your bundle, or provided within each .lproj folder if you localize your launch images. Learn more about iPhone 5 support and app launch images by reviewing the 'iOS Human Interface Guidelines' at https://developer.apple.com/ios/human-interface-guidelines/graphics/launch-screen."
參考鏈接
WARNING ITMS-90704: "Missing App Store Icon. iOS Apps must include a 1024x1024px App Store Icon in PNG format. Without providing the icon in the Asset Catalog or via iTunes Connect, apps cannot be submitted for App Review or Beta App Review. Refer to https://developer.apple.com/ios/human-interface-guidelines/icons-and-images/app-icon/ for more information."
需要一張 1024 X 1024的icon
參考鏈接
Missing Info.plist key - This app attempts to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSPhotoLibraryUsageDescription key with a string value explaining to the user how the app uses this data.
意思就是plist必須包含上面字符串的鍵值對(duì)向用戶解釋?xiě)?yīng)用程序如何使用這些數(shù)據(jù)。
找到原因、iOS10之后、蘋(píng)果對(duì)app使用用戶權(quán)限更嚴(yán)格
參考鏈接
16.AppStore IPV6
rn是支持的
參考鏈接
Could not list contents of 'XXX'
Couldn't follow symbolic link.的錯(cuò)誤.
參考鏈接
18.查看android .jks文件信息
keytool -list -v -keystore [jks文件-全路徑]
* What went wrong:
Execution failed for task ':app:bundleReleaseJsAndAssets'.
> A problem occurred starting process 'command 'node''

這個(gè)錯(cuò)誤的可能原因是gradle deamon的緩存問(wèn)題,關(guān)掉cradle deamon,重新再執(zhí)行一次就可以解決。
$ ./gradlew --stop
還是無(wú)效嘗試下邊方法
gradle.properties中加入
NODE_PATH=/usr/local/bin/node
build.gradle中
project.ext.react = [
nodeExecutableAndArgs: hasProperty('NODE_PATH')?[NODE_PATH]:null
]

參考鏈接
java.lang.RuntimeException: com.facebook.react.devsupport.JSException: Attempted to redefine property 'right'. (index.android.bundle:765)
這個(gè)錯(cuò)誤發(fā)生在android 打包release上,如果網(wǎng)上所有解決方案都不行的時(shí)候可以嘗試下,首先在index.android.bundle文件中定位765行,看屬于哪個(gè)文件,在工程中查找right是否在一個(gè){}中被賦值兩次。
因?yàn)槭莚elease版本,所以日志沒(méi)法看,如果Android Stuido 也無(wú)法查看日志可以使用adb命令
adb logcat *:E //查看錯(cuò)誤log
adb logcat -t1000 *:E //查看最近1000行錯(cuò)誤log

Error type 3
Error: Activity class {com.xx.xx/com.xx.xx.MainActivity} does not exist.
依舊檢查沒(méi)有錯(cuò)誤且嘗試網(wǎng)上所有方法都無(wú)效情況下,猜測(cè)是否與多渠道打包配置有關(guān)
注釋后編譯通過(guò),
// flavorDimensions "default"
// productFlavors {
// // qihu360 {dimension "default"} // 360手機(jī)助手
// // yingyongbao {dimension "default"} // 騰訊應(yīng)用寶
// fir_im {dimension "default"} // 豌豆莢
// }
To run dex in process, the Gradle daemon needs a larger heap.
It currently has 1024 MB.
For faster builds, increase the maximum heap size for the Gradle daemon to at least 1536 MB.
To do this set org.gradle.jvmargs=-Xmx1536M in the project gradle.properties.
For more information see https://docs.gradle.org/current/userguide/build_environment.html
取消注釋這條線在 gradle.properties:
參考鏈接
* What went wrong:
Execution failed for task ':app:transformDexWithDexForRelease'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Landroid/support/coreutils/BuildConfig;
在build.gradle中添加
multiDexEnabled true
參考鏈接