Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with split apks (INSTALL_FAILED_INVALID_APK: Failed to extract native libraries, res=-2) #72

Closed
kasnder opened this issue Mar 17, 2021 · 9 comments

Comments

@kasnder
Copy link

kasnder commented Mar 17, 2021

Hello,

I'm trying to use ZipDiff for the Twitter app.

When downloading for an arm64 device from the German Google Play Store, this comes in 5 .apk files:

  • base.apk
  • split_config.arm64_v8a.apk
  • split_config.de.apk
  • split_config.en.apk
  • split_config.xxhdpi.apk

Unfortunately, if I apply AndroidSDK#apksigner(ApkNormalized(AndroidSDK#apksigner(newZip))) to split_config.arm64_v8a.apk I get the following error when installing with adb install-multiple *.apk:

adb: failed to finalize session
Failure [INSTALL_FAILED_INVALID_APK: Failed to extract native libraries, res=-2]

Installing works without problems if I only apply AndroidSDK#apksigner(newZip) to split_config.arm64_v8a.apk and AndroidSDK#apksigner(ApkNormalized(AndroidSDK#apksigner(newZip))) tothe other .apk files.

@kasnder
Copy link
Author

kasnder commented Mar 17, 2021

I assume that libraries within split_config.arm64_v8a.apk are wrongly compressed or aligned after running ApkNormalized.

@kasnder
Copy link
Author

kasnder commented Mar 17, 2021

Additionally, I cannot run ZipDiff on split_config.arm64_v8a.apk without running ApkNormalized.

Running ZipDiff split_config.arm64_v8a.apk split_config.arm64_v8a-modified.apk split_config.arm64_v8a.ZipDiff results in:

...
check ZipPatch result Byte By Byte Equal ERROR!
  (did newZip=AndroidSDK#apksigner(ApkNormalized(AndroidSDK#apksigner(newZip))) before running ZipDiff?)
...

@sisong
Copy link
Owner

sisong commented Mar 18, 2021

the cmdline ApkNormalized version is 1.3.6?
you can make it by yourself:

$cd <ApkdiffPatch>
$make

I have't tested with split apks,
Can you email these 5 .apk files to me([email protected])?

@kasnder
Copy link
Author

kasnder commented Mar 19, 2021

Oh, it's 1.3.5. I was using the tagged release from the webpage. I'll check again!

@sisong
Copy link
Owner

sisong commented Jul 1, 2021

Possible attempt:

  1. packed apk files to one *.apks (or *.aab) file , and run apksigner?
  2. like bundletool , signed split apks

@sisong
Copy link
Owner

sisong commented Jul 1, 2021

I Success!
I test Twritter split apks( base.apk split_config.arm64_v8a.apk split_config.de.apk split_config.en.apk split_config.xxhdpi.apk )
edit AndroidManifest.xml file in base.apk,change android:extractNativeLibs="false" to android:extractNativeLibs="true"
then all apks do ApkNormalized & AndroidSDK#apksigner
run: adb install-multiple base.apk split_config.arm64_v8a.apk split_config.de.apk split_config.en.apk split_config.xxhdpi.apk
result "Success", and the TWritter app can be run on Android.

@kasnder
Copy link
Author

kasnder commented Jul 1, 2021

Thanks for clarifying! I really don't like the latest changes to the APK format by Google..

@sisong
Copy link
Owner

sisong commented Jul 2, 2021

same don't like

@sisong
Copy link
Owner

sisong commented Dec 11, 2023

now, this lib new version supported page-align uncompressed .so files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants