Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

打包上传后,安卓提示没有index.android.bundle #13

Open
ace0109 opened this issue Nov 27, 2020 · 12 comments
Open

打包上传后,安卓提示没有index.android.bundle #13

ace0109 opened this issue Nov 27, 2020 · 12 comments

Comments

@ace0109
Copy link

ace0109 commented Nov 27, 2020

请问一下,为什么我打包没有生成index.android.bundle呢?
我第一次使用RN开发。

@fwh1990
Copy link
Owner

fwh1990 commented Nov 27, 2020

请问RN版本号和你的操作系统

@fwh1990
Copy link
Owner

fwh1990 commented Nov 27, 2020

是报错了吗?打包完后查看 android/app/build/generated/assets/react/release,这里有你想要的文件

@ace0109
Copy link
Author

ace0109 commented Nov 30, 2020

@fwh1990 RN版本: 0.63 操作系统:macos 10.15.7

用这个工具打包上传到蒲公英后,安卓安装到手机上,提示如下图:
image

@fwh1990
Copy link
Owner

fwh1990 commented Nov 30, 2020

这个界面看起来怎么像是开发环境?

@ace0109
Copy link
Author

ace0109 commented Nov 30, 2020

@fwh1990 是 我打包的是开发环境。因为生产环境的包也是报这个 不过它会直接闪退。网上查了说要在src创建一个assets目录,手动生成一个jsbundle文件?是这样吗?

@fwh1990
Copy link
Owner

fwh1990 commented Nov 30, 2020

有办法创建一个demo仓库吗?我这边调试看看

@ace0109
Copy link
Author

ace0109 commented Nov 30, 2020

@fwh1990 我等会弄个仓库给你。你看一下这个图,是执行npx upload-pgy命令完成后,从蒲公英上下载的apk,打开就闪退了。报告里提示这个。
image

@ace0109
Copy link
Author

ace0109 commented Nov 30, 2020

@fwh1990 对了 我从android/app/build/output拿到的apk安装是没有问题的。

@fwh1990
Copy link
Owner

fwh1990 commented Nov 30, 2020

@fwh1990 对了 我从android/app/build/output拿到的apk安装是没有问题的。

本质上上传的apk也是从这个目录获取的

@ace0109
Copy link
Author

ace0109 commented Dec 1, 2020

@fwh1990 我发现,执行./gradlew assembleRelease后,在build里拿到的apk是正常的。但是执行npx upload-pgy,build里的apk就会报错,提示没有index.android.bundle文件。。。请问,执行npx upload-pgy本质上是不是也是cd android && ./gradlew assembleRelease,还有没有其它参数,不然怎么会跟./gradlew assembleRelease的结果不一样呢。

@fwh1990
Copy link
Owner

fwh1990 commented Dec 1, 2020

默认是 ./gradlew assemblerelease,大小写的差别。您可以在 这个位置 输出日志

echo "指令:./gradlew assemble$pack_variant"

或者更改一下指令试试:

- eval "./gradlew assemble$pack_variant"
+ ./gradlew assemble$pack_variant

问题可能在这几点:
1、执行的不是assemblerelease
2、大小写问题
3、eval造成结果不一致

@ace0109
Copy link
Author

ace0109 commented Dec 3, 2020

@fwh1990 找到问题了,原因是gradle版本的问题,之前升到了4.1.1,导致打包没有把index.android.bundle打包进去。我降级为原来的3.5.3就可以了。
facebook/react-native#30177

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants