INSTALL_FAILED_NO_MATCHING_ABIS error on Android 8

2019-01-15 03:41发布

问题:

I am trying to build my app connecting my Pixel phone. I recently upgraded my phone to Android 8. I was able to build and open the app in my phone until the last upgrade, but after this upgrade, I get Failure [INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries, res=-113] error.

Below is my gradle file. Can someone please tell me what is the issue ??

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion '26.0.1'
    defaultConfig {
        applicationId "com.my.app.googlemaps"
        minSdkVersion 16
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
        multiDexEnabled = true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    splits {
        abi {
            enable true
            reset()
            include 'x86', 'armeabi-v7a'
            universalApk true
        }
    }
    lintOptions {
        abortOnError false
    }
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
    }
    productFlavors {
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
...
    testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'

回答1:

It had the same problem, it worked after replacing an apache library (commons-io) with a different commons-io, that was from another bundle.

The problem occured to me after switching to a new development device (Pixel Phone w/ Android 8.0 Oreo).

Solution 1

In your case, you could stop using your local jars from the filesystem (compile fileTree(include: ['*.jar'], dir: 'libs')) and use proper gradle dependencies from bintray (e.g.).

Original gradle dependency (threw the same error that you describe):

ERROR: Failure [INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries, res=-113]

dependencies {
    compile 'org.apache.directory.studio:org.apache.commons.io:2.4'
    compile 'commons-cli:commons-cli:1.4'
}

Working build.gradle with proper commons-io artifacts:

dependencies {
    ...
    compile group: 'commons-io', name: 'commons-io', version: '2.5'
    compile group: 'commons-cli', name: 'commons-cli', version: '1.4'
    ...
}

Ignore the different dependency notation, it doesn't matter

Solution 2

You define multiple target ABI, did you check, which one your device supports. Perhaps you have to add another one, to be compatible to your device ABI.

You can define them in the Application.mk

Also see:

  • https://developer.android.com/ndk/guides/abis.html
  • https://developer.android.com/ndk/guides/application_mk.html
  • http://androidlad.blogspot.com/2016/10/installfailednomatchingabis-when.html
  • [INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries, res=-113]
  • INSTALL_FAILED_NO_MATCHING_ABIS when install apk