Cannot install signed release build of APK (Got INSTALL_FAILED_INVALID_APK: Failed to extract native libraries)

huangapple go评论72阅读模式
英文:

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

然后我尝试了以下操作:

  1. 安装了apk的发布版本 => 安装成功
  2. 使用.keystore文件签名了发布版本 => 安装失败

我尝试的是:

  1. 清除Google Play商店的缓存
  2. 并尝试以以下方式签名应用程序

使用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

  1. Installed release build of apk => Installation successful
  2. I signed the release build with .keystore file => Installation failed

What I tried is

  1. Clear play store cache
  2. 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

&lt;application
         android:extractNativeLibs=&quot;true&quot;  // &lt;--- 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

huangapple
  • 本文由 发表于 2023年7月3日 14:40:14
  • 转载请务必保留本文链接:https://go.coder-hub.com/76602381.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定