问题描述
我有一个使用react native创建的应用程序.我正在尝试在我的设备上安装该应用程序.但是显示此错误应用程序未安装-软件包似乎已损坏".
I've an app created using react native. I am trying to install the app on my device.But showing this error "app not installed -package appears to be corrupted".
这是什么原因?我尝试了以下方法来构建apk.
What would be the reason? I've tried the following method to build apk.
gradlew assembleRelease
.
推荐答案
按照这些说明进行操作....它对我有用
先决条件-您必须具有密钥库文件,如果没有,请按照说明打开cmd
运行keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000
并完成.您将拥有一个密钥库文件.现在,请按照以下步骤操作.
Prerequisite - You must have a keystore file, If you don't have then Open cmd
run keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000
follow instructions and you are done.You will have a keystore file. Now follow these steps.
1.在Windows cd android
上,然后运行gradlew assembleRelease
1 .On windows cd android
and then run gradlew assembleRelease
2.在此位置android/app/build/outputs/apk/release/app-release-unsigned.apk
3.将此APK复制到jdk
安装目录的bin
文件夹中(我的目录为C:\Program Files\Java\jdk1.8.0_181\bin
)[基本上,在此步骤中,我们尝试转到与jarsigner
相同的目录]
3 .Copy this APK to bin
folder of jdk
installation directory ( for me directory was C:\Program Files\Java\jdk1.8.0_181\bin
) [ Basically in this step we are trying to go to the same directory as jarsigner
]
4.还将密钥库文件复制到此(C:\Program Files\Java\jdk1.8.0_181\bin
)目录.
4 .Also Copy your keystore file to this ( C:\Program Files\Java\jdk1.8.0_181\bin
) directory.
5.现在在Administrator mode
中打开cmd
并运行cd C:\Program Files\Java\jdk1.8.0_181\bin
5 .Now Open cmd
in Administrator mode
and run cd C:\Program Files\Java\jdk1.8.0_181\bin
6.现在运行jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore<<your keystore file name >> <<your apk file name>> alias_name
6 .Now run jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore<<your keystore file name >> <<your apk file name>> alias_name
这是您的 apk ,现在在cd C:\Program Files\Java\jdk1.8.0_181\bin
此处找到已签名的apk.运行它,现在应该安装了.
Here goes your apk , now find your signed apk here cd C:\Program Files\Java\jdk1.8.0_181\bin
. Run it, Now it should install.
这篇关于应用未安装的软件包似乎已损坏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!