Targeting Sdk Android Q Results In Failed To Finalize Session : Install_failed_invalid_apk: Failed To Extract Native Libraries, Res=-2
Once I switch my target api to 'Q' I cannot install the APK on Android Q Emulator. I get error: Failed to finalize session : INSTALL_FAILED_INVALID_APK: Failed to extract nativ
Solution 1:
This happens because of an issue with zipalign, see - https://issuetracker.google.com/issues/37045367. You need to set extractNativeLibs
in your Application Tag on AndroidManifest.xml
<applicationandroid:allowBackup="false"android:label="@string/app_name"android:extractNativeLibs="true"...
>
If you are using adb
to install the apk try adding -t
flag
adb install -t <path-to-apk>
Solution 2:
If you want android:extractNativeLibs="false"
, use zipalign with -p
key in order to page align ELFs within ZIP:
zipalign -p4 app.apk app-aligned.apk
Solution 3:
I also got this error in AWS Device Farm. Turns out they have sdk version 21 installed and my minSdkVersion
was set to 24. Lowering my minSdkVersion
to 21 resolved this. This error was getting returned on trying to install apk on the test device. Hope this helps for anyone else setting up device farm on android.
Post a Comment for "Targeting Sdk Android Q Results In Failed To Finalize Session : Install_failed_invalid_apk: Failed To Extract Native Libraries, Res=-2"