react-native 打包APK
参考文档 Tags: https://reactnative.cn/docs/0.51/signed-apk-android.html#content
注意:
- 文档中生成签名秘钥的步骤可以通过Android Studio生成
- 文档中gradle变量可以不设,则在
android/app/build.gradle
中需要明文配置签名(有安全隐患)
可能遇到的问题:
issue 1
Could not find com.android.tools.lint:lint-gradle:26.1.1.
fixed
在android/build.gradle
文件中进行如下修改
复制代码
1
2
3
4
5
6
7
8
9
10
11
allprojects {
repositories {
mavenLocal()
jcenter()
google() //添加这一行
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
}
}
issue 2
Could not list contents of ‘xxxxx/node-pre-gyp/node_modules/.bin/detect-libc’.
Couldn't follow symbolic link
fixed
重新安装根目录下的node_modules
rimraf node_modules && npm install
issue 3
Failed to process resources, see aapt output above for details.
打包包含有本地图片资源时报的错误
fixed
在android/gradle.properties
文件添加这一句
android.enableAapt2=false
最后
以上就是敏感糖豆最近收集整理的关于react-native 打包apkreact-native 打包APK的全部内容,更多相关react-native内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复