英文:
Cannot install signed release build of APK (Got INSTALL_FAILED_INVALID_APK: Failed to extract native libraries)
问题
我曾在Google Play商店中使用ionc制作了一个应用程序。这个应用程序非常老旧。现在我已经从头开始使用flutter构建了一个具有相同包标识(package id)
的新应用程序。
问题,
我的新应用程序更新被Google Play商店接受,并可供下载。应用程序可以下载,但显示无法安装MyApp
然后我尝试了以下操作:
- 安装了
apk
的发布版本 => 安装成功 - 使用
.keystore
文件签名了发布版本 => 安装失败
我尝试的是:
- 清除Google Play商店的缓存
- 并尝试以以下方式签名应用程序
使用APKSIGNER
步骤1 zipalign -v 4 app-release.apk MyApp.apk
步骤2 apksigner sign --ks myapp.keystore --v1-signing-enabled true --v2-signing-enabled true MyApp.apk
使用Jar Signer
步骤1: jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore myapp.keystore app-release.apk myappalias
步骤2: zipalign -v 4 app-release.apk MyApp.apk
我尝试安装了其他应用程序,无论是已签名还是未签名的发布版本,都可以正常工作。
更新
尝试通过adb进行安装
adb install MyApp.apk
收到以下错误消息
失败 [INSTALL_FAILED_INVALID_APK:无法提取本机库,res=-2]
有人能否为此提供解释,对于这个特定的应用程序有什么问题?
英文:
I had an app made in ionc in Google play store. Which is very old. And now I have built app from scratch using flutter with same package id
as before.
Problem,
My new app update is accepted by play store and is available for download. The app gets downloaded, but says Can't install MyApp
I then tried the following
- Installed release build of
apk
=> Installation successful - I signed the release build with
.keystore
file => Installation failed
What I tried is
- Clear play store cache
- And tried signing app in following ways
Using APKSIGNER
Step 1 zipalign -v 4 app-release.apk MyApp.apk
Step 2 apksigner sign --ks myapp.keystore --v1-signing-enabled true --v2-signing-enabled true MyApp.apk
Using Jar Signer
Step 1: jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore myapp.keystore app-release.apk myappalias
Step 2: zipalign -v 4 app-release.apk MyApp.apk
I tried installing other app both signed and unsigned release build, both worked.
UPDATE
tried to install via adb
adb install MyApp.apk
Got following error
Failure [INSTALL_FAILED_INVALID_APK: Failed to extract native libraries, res=-2]
Can anybody shed light on this, what is wrong in the case of this particular App?
答案1
得分: 0
以下是翻译好的部分:
问题出在zipalign
上
在主要的application
标签中添加以下标记行
<application
android:extractNativeLibs="true" // <--- 添加这行
如果你不想在清单文件中添加上述行,你可以在执行zipalign
时添加-p
标签
zipalign -p 4 app.apk app-aligned.apk
英文:
To those who stumble upon this thread. Here is how I fixed
The issue was due to zipalign
Add marked line to main application
tag
<application
android:extractNativeLibs="true" // <--- Add this line
If you don't want to add above line in manifest file you can add -p
tag while executing zipalign
zipalign -p 4 app.apk app-aligned.apk
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论