Android Studio正在为反应本机项目生成非常老的apk,例如3个月大的apk [英] Android Studio is generating very old apk for react-native project like 3 months old

查看:73
本文介绍了Android Studio正在为反应本机项目生成非常老的apk,例如3个月大的apk的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Android Studio正在为反应本机项目(如3个月大)生成非常旧的apk.但是在运行"react-native run-android"命令时可以在模拟器中完美运行

Android Studio is generating very old apk for react-native project like 3 months old. But running perfectly in emulator while running this command "react-native run-android"

过程- * 打开文件所在位置 * Build => Build Bundles => Build APK

Process - * Open file location * Build => Build Bundles => Build APK

尝试重新安装android studio,但仍然变旧了apk

Tried re-installing android studio but still getting old APK

推荐答案

在旧的本地版本中,当我们生成android APK时,有时捆绑包是旧的,我们必须自己生成.
在本机0.61中,我发现问题已消除. 在旧版本中,首先应将以下脚本添加到package.json

In the old react-native version, when we generate the android APK, sometimes the bundle is old, we have to generate it by ourself.
In the react-native 0.61, I find the problem is dismissed. In the old version, firstly you should add the following script to the package.json

"scripts":{
...
"bundle-android": "react-native bundle --entry-file index.js  --platform android --dev false --bundle-output ./android/app/src/main/assets/index.android.bundle --assets-dest ./android/app/src/main/res",
...
}

当您生成apk时,首先要在termail中运行以下脚本来生成新的包

the when you generate the apk , you firstly run the follwing script in the termail to generate the new bundle

npm run bundle-android

捆绑软件成功输出后,进入android目录并组装APK

when the bundle outputs successfully, then go into the android directory and assemble the APK

cd android

./gradlew assembleRelease

这篇关于Android Studio正在为反应本机项目生成非常老的apk,例如3个月大的apk的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆