[INSTALL_FAILED_INVALID_APK: Failed to extract native libraries, res=-2] after Compile

See original GitHub issue

Information

  1. Apktool Version (apktool -version) - 2.3.0
  2. Operating System (Mac, Linux, Windows) - Windows
  3. APK From? (Playstore, ROM, Other) - PlayStore

Stacktrace/Logcat

Include stacktrace here

After recompile apk and signed I have this issue when install recompiled apk…

`Failure [INSTALL_FAILED_INVALID_APK: Failed to extract native libraries, res=-2]

Steps to Reproduce

  1. apktool apktool.bat r …apk

Frameworks

If this APK is from an OEM ROM (Samsung, HTC, LG). Please attach framework files (.apks that live in /system/framework or /system/priv-app)

APK

If this APK can be freely shared, please upload/attach a link to it.

http://www17.zippyshare.com/v/cE36EDY0/file.html

Questions to ask before submission

  1. Have you tried apktool d, apktool b without changing anything? yes
  2. If you are trying to install a modified apk, did you resign it? yes
  3. Are you using the latest apktool version? yes

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:18 (7 by maintainers)

github_iconTop GitHub Comments

27reactions
giacomoferretticommented, Aug 28, 2020

Seems to work with 2.4.2-d3f9d5-SNAPSHOT.

After rebuilding, zipalign it using this command: zipalign -p -f 4 input.apk output.apk Then sign it with apksigner and should work now.

20reactions
rosasurfercommented, Nov 10, 2019

With the current version of the Android build environment the manifest attribute /manifest/application[@android:extractNativeLibs] is always set to false. This means the libraries in the APK are page aligned by the build environment (not to confuse with zipaligning the whole APK) and the loader loads them directly from the APK (presumably storage space considerations). When the ApkTool (version 2.4.0) recompiles such an APK it doesn’t change the manifest settings but due to the recompilation the resulting library file layout in the APK is not page aligned anymore, and that’s the cause the loader fails and the error occures. Removing the attribute or explicitely setting it to true (the default value) prevents the bug to happen.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Targeting SDK Android Q results in Failed to finalize session ...
Targeting SDK Android Q results in Failed to finalize session : INSTALL_FAILED_INVALID_APK: Failed to extract native libraries, res=-2.
Read more >
Failed to extract native libraries, res=-2 bitrise build
Description of the issue. After adding Twilio library to the project generated APK size is twice bigger then when I'm building from Android...
Read more >
Failed to extract native libraries, res=-2] | by July | Medium
The question says that the native library cannot be extracted. Cause Analysis: Google introduced extractNativeLibs after Android 6.0: android:extractNativeLibs:
Read more >
Failed to extract native libraries, res=-2 - MSDN - Microsoft
Hi! After upgrading to Version 8.7 (build 2037) I can't distribute my Android APK, it works fine when running on Release-mode thru VS ......
Read more >
Failed To Extract Native Libraries, Res=-113 - ADocLib
To get around it use the following block in your app's build.gradle file: ... INSTALLFAILEDINVALIDAPK: Failed to extract native libraries res2 bitrise build...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found