React Native Release App.APK搜索Metro服务器
我创建了我的Android应用程序的发布。但是,我已经使用Android Studio来创建它,但是,当我安装应用程序时,它会自动关闭。出现的错误如下:
我的第一个应用程序的规格如下(App1):
-react native : 0.68.1
-buildToolsVersion = "31.0.0"
-minSdkVersion = 21
-compileSdkVersion = 31
-targetSdkVersion = 31
-buildGradle : 7.1.3
我的第二个应用程序具有以下规格(App2)的情况也是如此:
-react native : 0.67.4
-buildToolsVersion = "30.0.2"
-minSdkVersion = 21
-compileSdkVersion = 30
-targetSdkVersion = 30
-ndkVersion = "21.4.7075529"
-buildGradle : 4.2.2
我需要的是签名的APK,我不需要一个调试是因为它编译了。非常感谢您。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我遇到了同样的问题。我的解决方案:
android/app/src/main/assests不存在。我创建了一个。
npx react-native bundle-平台android -dev false-entry-file index.js - bundle-undle-undle-undle-underput android/app/src/src/src/src/assets/index.android.bundle.bundle
在此阶段,发布过程会导致错误。我将在android/app/src/main/res下删除所有可绘制的文件夹。不要删除Android/app/src/main/res/drawable文件夹!
在Android文件夹中
I had the same problem. My solution:
android/app/src/main/assests is not exist. I created one.
npx react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle
At this stage, the release process results in an error. I am delete all drawable-* folders under android/app/src/main/res. Don't delete android/app/src/main/res/drawable folder!.
in android folder
./gradlew assembleRelease
and success!错误日志清楚地提到了
index.android.bundle
文件是此处的罪魁祸首。要解决此问题,请运行以下命令,npx react-native bundle -platform-dev false-entry-file-entry-file index.js - bundle-out-out-undle-out-out-under-untroid/app/app/src/src/src/src/assets/index。 Android.bundle
这将创建正确的
index.android.bundle
文件,您将能够运行该应用程序。The error log has clearly mentioned that the
index.android.bundle
file is the culprit here. To fix this, run the following command,npx react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle
This will create the correct
index.android.bundle
file and you will be able to run the app.