Search code examples
androidandroid-10.0

Migrating to android Q app install failed


I have migrated my android project to android q in android studio canary but whenever I try to run my project on my Google Pixel 2. I am getting this error I have also uninstalled the previous version of the app. I have done everything clean project rebuild invalidate the cache, but still see below error log:

11:40 AM    Failed to commit install session 1536794838 with command cmd package install-commit 1536794838. Error: INSTALL_FAILED_INVALID_APK: Failed to extract native libraries, res=-2
11:40 AM    Session 'app': Changes were not applied.
                    The application could not be installed: UNKNOWN_ERROR
                    Retry

Solution

  • try to add below in your manifest.xml inside application tag

    android:extractNativeLibs="false"
    

    This flag is to indicate whether or not the package installer should extract the native libraries from the APK to the filesystem. If set to false, then your native libraries must be page aligned and stored uncompressed in the APK. Hence, after setting it to false, you should also have below options configured in your build.gradle

    packagingOptions{
        doNotStrip "*/armeabi/*.so"
        doNotStrip "*/armeabi-v7a/*.so"
        doNotStrip "*/x86/*.so"
        doNotStrip "*/x86_64/*.so"
    }