NervJS / taro-native-shell

Taro 原生 React Native 壳子
MIT License
200 stars 106 forks source link

release打包结果是React的默认示例页面 #97

Closed JASON00000 closed 6 months ago

JASON00000 commented 6 months ago

Taro v3.6.17 Taro-native-shell v0.70.0

生成 app-debug.apk:android 模拟器、真机都正常

使用 ./gradlew assembleRelease 或者 AS 打包 生成app-release.apk:显示 “Welcome to RN”

使用 ./gradlew assembleRelease 虽然结果BUILD SUCCESSFUL,但是有一条警告信息: 这个警告信息表明 Gradle 发现了一些问题,并且为了确保正确性,已经禁用了与任务 :app:compressReleaseAssets 相关的执行优化。具体地,问题是任务 :app:compressReleaseAssets 使用了任务 :app:copyReleaseBundledJs 的输出,但没有声明明确的或隐含的依赖关系。这可能会导致在执行任务顺序不确定的情况下产生不正确的结果。

Task :app:compressReleaseAssets Execution optimizations have been disabled for task ':app:compressReleaseAssets' to ensure correctness due to the following reasons:

  • Gradle detected a problem with the following location: '/Users/jay/app/taro-native-shell/android/app/build/intermediates/assets/release/mergeReleaseAssets'. Reason: Task ':app:compressReleaseAssets' uses this output of task ':app:copyReleaseBundledJs' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.5.1/userguide/validation_problems.html#implicit_dependency for more details about this problem.
zhiqingchen commented 6 months ago

taro-native-shell 是原生工程,禁用了 jsbundle 的打包 https://github.com/NervJS/taro-native-shell/blob/0.70.0/android/app/build.gradle#L85

需要在 js 工程进行 build 出 jsbundle https://docs.taro.zone/docs/react-native#%E9%85%8D%E7%BD%AE-output

JASON00000 commented 6 months ago

1、确实按照文档配置输出执行 yarn build:rn 输出了 index.android.bundle 、index.android.map。 只是 debug.apk 是我的工程 release.apk是官方demo

2、注释该行会导致新问题,debug.apk 和 release.apk 都运行闪退。我目前只能先取消注释,保证debug.apk可运行测试。 // apply from: "../../node_modules/react-native/react.gradle"

zhiqingchen commented 6 months ago

还有问题建议直接使用集成一起的方案 https://docs.taro.zone/docs/react-native#%E9%9B%86%E6%88%90%E6%A8%A1%E5%BC%8F