Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 403
WatsMyName Avatar asked Dec 31 '25 15:12

WatsMyName


1 Answers

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
like image 198
WatsMyName Avatar answered Jan 02 '26 03:01

WatsMyName