81

I have an issue with third party libraries that are imported to my project.

I read quite a lot of articles about that but do not get any information how properly handle it.

I put my classes .so to the folder.

enter image description here

Problem is that the i try to run the app i receive

[INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries, res=-113]
Zoe
  • 27,060
  • 21
  • 118
  • 148
Oleg Gordiichuk
  • 15,240
  • 7
  • 60
  • 100
  • try this link : for **android 3.0.1**: https://stackoverflow.com/a/49473570/3400991 – Shobhakar Tiwari Mar 25 '18 at 07:47
  • 2
    I faced the same issue when tried to install release apk on emulator. In my case what worked for me is installing the release apk on real device :) Hope it helps somebody else too – MBH Apr 01 '20 at 13:19

13 Answers13

122

July 25, 2019 :

I was facing this issue in Android Studio 3.0.1 :

After checking lots of posts, here is Fix which works:

Go to module build.gradle and within Android block add this script:

splits {
    abi {
        enable true
        reset()
        include 'x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'mips', 'mips64', 'arm64-v8a'
        universalApk true
    }
}

Simple Solution. Feel free to comment. Thanks.

Shobhakar Tiwari
  • 7,862
  • 4
  • 36
  • 71
  • 2
    it will create apk that are intended for each type (release.apk, armeabi-v7a-release.apk, universal-release.apk, x86-release.apk) check if you use the jniLibs folder, usually that's what generates the problem – MrZ Jul 24 '18 at 07:30
  • 1
    You can add in include also ,'x86_64' – seinta Sep 21 '18 at 12:14
  • 9
    Have the same error. But also in Gradle add this ( splits{... ) nothing change! – Bobert Dec 06 '18 at 16:15
  • This did not work for me, using Samsung Galaxy. Prior to Android 8.0, this worked very well. – MG Developer May 09 '19 at 02:52
  • @MGDeveloper did u try other values in it like mips64, it may work – Shobhakar Tiwari May 16 '19 at 19:10
  • @ShobhakarTiwari So it turns out that one of the two of changes we made to the app were bad. One change had errors in our app activity xml which caused "Aapt2Exception: AAPT2 error" and the other change included a dependency jar which had previous version jar packaged inside the jar file itself. After deleting those changes, the app is now installed. I also realized my error was producible on any device that has Android 8.0, real or emulator. Hence I am not sure if I needed this splits configuration, and if this answer is actually a fix or work around. I can create a new answer if needed. – MG Developer May 20 '19 at 02:34
  • 1
    I'm facing this when running my project into emulator x86. And this solutions works seamlessly – mochadwi Jun 18 '19 at 07:31
  • 1
    universalApk was the key for me after updating to latest gradle [React Native] – Jordan Grant Sep 10 '19 at 05:56
  • `ndk - abiFilters` conflicts with `splits - abi` one and doesn't throw except if `splits - abi - universalApk` is set to false ! In any case, do not use both option types at the same time ! – nuKs Oct 20 '19 at 01:14
  • this didn't fix the issue – pete Aug 02 '20 at 23:50
  • The actual fix was to remove: implementation 'org.apache.directory.studio:org.apache.commons.io:2.4' – pete Aug 03 '20 at 01:12
  • build.gradle is an existing file when working with Android Studio project, but it is not available on Xamarin Android project, anyone know here to add that info on a Xamarin Android project? – Windgate May 17 '21 at 13:41
  • So why did you never have to do this for Ant? Not a fan of Gradle.. – Sixjac Mar 13 '22 at 11:37
  • 1
    not working at all with android studio arctic fox 2020.3.1 | patch 3 – EAS Mar 25 '22 at 10:07
  • not working - AS Chipmunk – Palejandro Jul 21 '22 at 12:09
  • Not working - Android Studio Bumblebee 2021.1.1 Patch 3 – Florentin Lupascu Aug 18 '22 at 07:51
  • Working with the update to the latest version of the gradle. Thanks for the suggestion – AlexKh Feb 21 '23 at 09:12
24

I faced same problem in emulator, but I solved it like this:

Create new emulator with x86_64 system image(ABI)

select device

select x86_64

That's it.

This error indicates the system(Device) not capable for run the application.

I hope this is helpful to someone.

Divakar Murugesh
  • 1,207
  • 1
  • 10
  • 14
14

13 September 2018 It worked for me when add more types and set universalApk with false to reduce apk size

splits {
    abi {
        enable true
        reset()
        include 'x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'mips', 'mips64', 'arm64-v8a'
        universalApk false
    }
}
moobi
  • 7,849
  • 2
  • 18
  • 29
Mostafa Anter
  • 3,445
  • 24
  • 26
  • 1
    @IgorGanapolsky to reduce time of generate apks and i don't need universalApk – Mostafa Anter Dec 21 '18 at 08:06
  • 1
    `ndk - abiFilters` conflicts with `splits - abi` one and doesn't throw except if `splits - abi - universalApk` is set to false ! In any case, do not use both option types at the same time ! – nuKs Oct 20 '19 at 01:14
13

If you got this error when working with your flutter project, you can add the following code in the module build.gradle and within Android block and then in the defaultConfig block. This error happened when I was trying to make a flutter apk build.

android{
    ...
    defaultConfig{
        ...
        //Add this ndk block of code to your build.gradle
        ndk {
            abiFilters 'armeabi-v7a', 'x86', 'armeabi'
        }
    }
}
gehbiszumeis
  • 3,525
  • 4
  • 24
  • 41
Abel Tilahun
  • 1,705
  • 1
  • 16
  • 25
  • @warning - `ndk - abiFilters` conflicts with `splits - abi` one and doesn't throw except if `splits - abi - universalApk` is set to false ! Do not use both at the same time ! – nuKs Oct 20 '19 at 01:12
  • 1
    ndk { abiFilters "armeabi", "x86", "armeabi-v7a","x86_64", "mips", "mips64", "arm64-v8a" } worked for me – user3875913 Apr 13 '20 at 11:41
  • 1
    I saw this error trying to install an apk from the game library LibGDX. It uses NDK resources. These three lines were the fix, thanks !! – ether_joe Jan 05 '22 at 02:32
10

Doing flutter clean actually worked for me

Steve
  • 914
  • 8
  • 17
6

Android 9 and Android 11 emulators have support for arm binaries.

https://developer.android.com/studio/releases/emulator#support_for_arm_binaries_on_android_9_and_11_system_images

I had the same issue while using x86 emulator with API level 29, trying to install an apk targeting arm ABI.

I tried x86 emulator with API level 30 and it worked fine.

Sfseyhan
  • 1,321
  • 1
  • 13
  • 18
3

My app was running on Nexus 5X API 26 x86 (virtual device on emulator) without any errors and then I included a third party AAR. Then it keeps giving this error. I cleaned, rebuilt, checked/unchecked instant run option, wiped the data in AVD, performed cold boot but problem insists. Then I tried the solution found here. he/she says that add splits & abi blocks for 'x86', 'armeabi-v7a' in to module build.gradle file and hallelujah it is clean and fresh again :)

Edit: On this post Driss Bounouar's solution seems to be same. But my emulator was x86 before adding the new AAR and HAXM emulator was already working.

Gultekin
  • 119
  • 1
  • 3
3

This is caused by a gradle dependency on some out-of-date thing which causes the error. Remove gradle dependencies until the error stops appearing. For me, it was:

implementation 'org.apache.directory.studio:org.apache.commons.io:2.4'

This line needed to be updated to a newer version such as:

api group: 'commons-io', name: 'commons-io', version: '2.6'
pete
  • 1,878
  • 2
  • 23
  • 43
2

As of 21st October 2021, i fixed this by adding these lines to the app level build.gradle

defaultConfig {
   ndk {
         abiFilters 'x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'mips', 'mips64', 'arm64-v8a'
        }
}
Glen Agak
  • 81
  • 4
1

Anyone facing this while using cmake build, the solution is to make sure you have included the four supported platforms in your app module's android{} block:

 externalNativeBuild {
            cmake {
                cppFlags "-std=c++14"
                abiFilters "arm64-v8a", "x86", "armeabi-v7a", "x86_64"
            }
        }
Ratul Doley
  • 499
  • 1
  • 6
  • 12
1

The solution that worked for me (Nov 2021) was adding an exclusion to the packagingOptions within the build.gradle file.

android {
    packagingOptions {
        exclude("lib/**")
    }
}

Specifically the exclude() part must be standalone and in the function even though it may show as deprecated (with a line through it in IntelliJ). That will resolve the issue.

Brandon
  • 1,401
  • 1
  • 16
  • 25
0

After some time i investigate and understand that path were located my libs is right. I just need to add folders for different architectures:

  • ARM EABI v7a System Image

  • Intel x86 Atom System Image

  • MIPS System Image

  • Google APIs

Oleg Gordiichuk
  • 15,240
  • 7
  • 60
  • 100
0

Make the splits depend on the same list of abis as the external build. Single source of truth.

android {
// ...
defaultConfig {
// ...
    externalNativeBuild {
        cmake {
            cppFlags "-std=c++17"
            abiFilters 'x86', 'armeabi-v7a', 'x86_64'
        }
    }
} //defaultConfig

splits {
    abi {
        enable true
        reset()
        include defaultConfig.externalNativeBuild.getCmake().getAbiFilters().toListString()
        universalApk true
    }
}
} //android
ppetraki
  • 428
  • 4
  • 11