【发布时间】:2019-07-30 21:03:22
【问题描述】:
我是 RN 的新手。我在构建发布 APK 时遇到问题。我正在执行以下步骤:
- rm -rf node_modules & npm install
- 生成包:
反应原生包
--platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets dest android/app/src/main/res/
- cd android & ./gradlew assembleRelease
app/build.gradle:
project.ext.react = [
entryFile: "index.js",
bundleInDebug: true,
bundleInRelease: true,
]
apply from: "../../node_modules/react-native/react.gradle"
....
bundleInRelease 选项似乎无法正常工作。然而 ./gradlew assembleDebug 完美运行!请帮忙!
【问题讨论】:
-
你只需要使用 assembleRelease。捆绑将自行发生。
-
我尝试过使用 assembleRelease。但是某些功能不起作用,当我在终端上启动 npm install 时,它运行良好。但是,当我使用 assembleDebug 构建 apk 时,一切正常。
-
“某些功能不起作用”是什么意思?你在保护你的应用吗?
-
我使用了 'react-native-bitcoinjs-lib' 库,而且,我知道没有 proguard 规则。当我启动调试 APK 时一切正常,但在发布 APK 时出现以下错误:“ECPair 类型的预期属性 '0',得到 k”
-
我注意到,当我设置 bundleInDebug: false 时,我在调试 apk 中遇到了类似的错误。
标签: react-native react-native-android create-react-native-app