Targeting SDK Android Q results in Failed to finalize session : INSTALL_FAILED_INVALID_APK: Failed to extract native libraries, res=-2
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
<application
android: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>
If you want android:extractNativeLibs="false"
, use zipalign with -p
key in order to page align ELFs within ZIP:
zipalign -p 4 app.apk app-aligned.apk