Targeting SDK Android Q results in Failed to finalize session : INSTALL_FAILED_INVALID_APK: Failed to extract native libraries, res=-2

浪子不回头ぞ 提交于 2019-12-13 11:58:04

问题


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 native libraries, res=-2

Android Studio (v3.3.2) recommends I uninstall apk first. I tried uninstalling apk and I still get the same error. App work if I downgrade target api to 28.


回答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

<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>


来源:https://stackoverflow.com/questions/55173004/targeting-sdk-android-q-results-in-failed-to-finalize-session-install-failed-i

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!