Related
After updating to Android Gradle plugin 3.6.0 (released Feb 24, 2020), several project independently started failing with:
No version of NDK matched the requested version 20.0.5594570. Versions available locally: 21.0.6113669
It's quite simple to "fix" this locally by installing the older expected ndk version:
sdkmanager 'ndk;20.0.5594570'
However, my question is: Where and how is this older version specified? And how do I update it so it matches the latest version 21.0.6113669?
The following solutions assume that the machine you are using currently has NDK installed and was previously able to build your project but started failing with the error "No version of NDK matched the requested version" after updating to Android Gradle plugin 3.6.0. Before proceeding make sure to have NDK installed.
Option 1:
You can simply select your locally installed NDK in the Project Structure Dialog
You can open the Project Structure Dialog by clicking File > Project Structure... or by pressing the hotkeys CTRL + ALT + SHIFT + S (on windows)
Once the Project Structure Dialog is open, go to SDK Location and select your locally installed version of NDK under Android NDK Location. Typically this is installed somewhere in your user folder then \AppData\Local\Android\Sdk\ndk\%ndk version% at least for Windows.
- from Android Studio 3.6 Build #AI-192.7142.36.36.6200805, built on February 12, 2020
Option 2:
Doing option 1 will edit your local.properties file for you and will work in most cases. But if you want to use a consistent NDK version on all machines you build the project with, according to this official guide, you can configure it from your module gradle script. Simply add the ndkVersion in your module gradle script's android{} block like so.
android {
ndkVersion "major.minor.build"
}
replacing the string between the doublequotes with the NDK version you want to use
Option 3:
If you want all projects built on a particular machine to use the same NDK version, you can also set ANDROID_NDK_HOME environment variable with the path to the NDK folder.
I have the same issue. I resolved it through the SDK manager under SDK Tools, click Show Package Details and then scroll under NDK (Side by side) and tick and apply the version you need. See image below:
My question for anyone is, why do we need this now for projects that do not require the NDK? As it turns out the NDK is a pre-existing requirement in the project I work on for a dependency!
It isn't necessary with Android gradle plugin > 4.1.0 (see also https://issuetracker.google.com/issues/144111441)
With < 4.1.0 I run into this too
No version of NDK matched the requested version 20.0.5594570. Versions
available locally: 21.0.6113669
Option 1:
You can simply select your locally installed NDK in the Project Structure Dialog works !
But is only valid for local builds, an I need a solution for CI
Option 2:
It's only works, when you specify it in every used module
android {
compileSdkVersion 28
ndkVersion "21.0.6113669"
...
}
Here it seems not to work https://github.com/hannesa2/panoramagl/pull/17/checks with this change https://github.com/hannesa2/panoramagl/pull/17/files#diff-cff4e8c294a5dc5e76308662ae1ddcacR6-R7
Option 3:
export ANDROID_NDK_HOME=/Users/{my-user}/Development/adt/sdk/ndk/21.0.6113669
works too as well !
To answer the part of your question not answered by others, "Where and how is this older version specified? And how do I update it so it matches the latest version 21.0.6113669?":
The default version is set by the Android Gradle plugin. Each version will default to whatever version of the NDK that we used during testing to guarantee the best possible compatibility.
The difference between this and earlier plugin versions is that it used to happily use any NDK that you happened to have installed. This caused a ton of "works on my machine" issues for users where their co-workers couldn't build the project, it wouldn't work on CI but would locally, etc. It wasn't a good situation.
You can pick a specific version of the NDK to use in your project by setting android.ndkVersion in your build.gradle. if you don't, it'll try to use the default version for the Gradle plugin that you're using.
The annoying bit is that most versions (until 4.1) will not automatically download the default version, which gives you the error you're seeing. If you explicitly pick a version in your build.gradle it actually will download automatically, and with 4.1 it will automatically download the default version too.
A thing that often confuses people is why this hits them when they're not using the NDK, or at least believe they are not. The answer in that case is that one of your dependencies includes native libraries and these need to be stripped before they are packed into the APK to keep size down, and strip comes from the NDK.
This worked for MacOS, check via Terminal:
cd ~/Library/Android/sdk
ls
If you see "ndk" and/or "ndk-bundle", delete them:
sudo rm -r ndk/
sudo rm -r ndk-bundle/
After deleting those folders, everything worked for me.
This is copied from GitHub
In the last version of Gradle there is no need to define the NDK versión inside the build.grade :
android {
...
ndkVersion "21.0.6352462"
...
}
We must install the suggested versión
or define the current available version into the Android NDK Location:
replace gradle classpath with this in Project level build.gradle
classpath 'com.android.tools.build:gradle:4.1.0'
in gradle-wrapper.properties add this line
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
I faced the same problem. Then i found the developer references here
So, the problem start with gradle version 3.6. Before 3.6 there was no default ndk specified. So, any version of ndk worked without any problem. But after adding default version, if we not add any ndkVersion in build.gradle then it search for the default version of ndk.
In my case, my gradle version was 3.6.3 and ndk installed 21.0.6113669 and i did not defined ndkVersion in my build.gradle. So, it search for default ndkVersion "20.0.5594570" according to my gradle version and gave me the same error. So, i simply add ndkVersion "21.0.6113669" in my build.gradle file and error gone.
In order to solve this problem, you must indicate to your IDE the version of your NDK in build.gradle. In this case, it should be version 21.0.6113669. For example:
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.remed_mobile"
minSdkVersion 16
targetSdkVersion 28
ndkVersion '21.1.6352462'
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
If you do not indicate your version number, then the IDE takes a default version. If you've upgraded gradle, then it might not find the right version.
Add this line in build.gradle(app)
android {
ndkVersion "21.0.6113669"
}
This will solve the problem
https://github.com/gradle/gradle/issues/12440#issuecomment-606188282
This workes for me
edit local.properties file to add this
ndk.dir=/xxxxx/Android/sdk/ndk-bundle
Android Studio -> Preferences -> System settings -> Android SDK -> Got to SDK tools and remove NDK(Side by Side) and apply.
ndkVersion "21.0.6113669" /// <<---Add this in your android -> app -> build.gradle file.
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
ndkVersion "21.0.6113669"
i had same problem, after a while i found a temporary solution.
rename ndk folder to ndk-bundle.
in your projects go to local.properties file and add this line before sdk.dir:
ndk.dir=<path to your ndk folder>
its mine:
ndk.dir=G\:\\SDK\\ndk-bundle
sdk.dir=G\:\\SDK
i hope it help you
I also got below error
No version of NDK matched the requested version 20.0.5594570. Versions available locally: 21.3.6113669
I just added my local NDK version to App level build.gradle file its solved.
android {
ndkVersion "My Available version here" (my case it 21.3.6113669)
}
flutter clean
flutter pub get
After upgrading to gradle:3.6.0 (or later). Try renaming or deleting the ndk and ndk-bundle folders located in C:\Users\<user>\AppData\Local\Android\Sdk
Credit goes to:
https://github.com/gradle/gradle/issues/12440#issuecomment-601214647
Change your classpath version to 3.5.0 inside your build.gradle, project level.
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
}
I have the same issue and it solved.
Open your module's build.gradle file and edit :
android {
**ndkVersion** "version number of you NDK"
}
No version of NDK matched the requested version 20.0.5594570
Here I got solution
1====>first download NDK if you don't have
2====>Rename your NDK as your Project need (like here I need 20.0.5594570)
3====>After that in android folder open gradle.properties file
here you put your ndk location like this
then do react-native run-android... that's it
NDK issues resolved
thanks you!
If you have trouble finding an exact version of NDK you can download it from here, it was the case for me my IDE required version 21.1.6352462 while this version no longer exists on the official site (https://developer.android.com/ndk/downloads)
All Android NDK Native Development Kit by API,Version and OSes
go to your app's build.gradle file;
in android{ } add your ndk version available, this shows in your error info you post. In this case, your version is "21.0.6113669"
No version of NDK matched the requested version 20.0.5594570. Versions available locally: 21.0.6113669
android {
ndkVersion "21.0.6113669"
}
I found this problem in as fox or 4 In X.
In the root directory of OS, open and hide Gradle folder
add file gradle.properties
add code
ndk.dir=/Users/your os name/Library/Android/sdk/ndk
doen~
first install NDk from android studio and Tools>sdk manager>sdk tools than download ndk version and
than in your local.properties set ndk path
like this:
ndk.dir=/Users/{yourUserName}/Library/Android/sdk/ndk/21.4.7075529
I couldn't install the specified version (a weird error from android studio, it might be related to the Silicon chip), so I specified a newer version of ndk in my build.gradle and everything worked.
[My Error: requested ndk version 22.0.7026061 did not match the version 20.0.5594570 requested by ndk.dir]
MySolution: There seems to be different ndk versions pointing out in different places
Please find below details for the same: Please go to
Project Structure=> SDK Location=> NDK Location(make sure to check one proper ndk version)
2)Project Structure=>Modules=> under NDK Version(check the same version you have added in first step)
PFA image forStep2
3)Gotoyour Android studio project=> go to local.properties file=> check your ndk version number
If all 3 steps are proper with one current proper NDK version your error would have solved.
Note: make sure to sync the project files, clean project, rebuild the project.
Hope this would solve your problem!! Happy Coding:)
I tried to install my app into Android L Preview Intel Atom Virtual Device, it failed with error:
INSTALL_FAILED_NO_MATCHING_ABIS
What does it mean?
INSTALL_FAILED_NO_MATCHING_ABIS is when you are trying to install an app that has native libraries and it doesn't have a native library for your cpu architecture. For example if you compiled an app for armv7 and are trying to install it on an emulator that uses the Intel architecture instead it will not work.
INSTALL_FAILED_NO_MATCHING_ABIS is when you are trying to install an app that has native libraries and it doesn't have a native library for your cpu architecture. For example if you compiled an app for armv7 and are trying to install it on an emulator that uses the Intel architecture instead it will not work.
Using Xamarin on Visual Studio 2015.
Fix this issue by:
Open your xamarin .sln
Right click your android project
Click properties
Click Android Options
Click the 'Advanced' tab
Under "Supported architectures" make the following checked:
armeabi-v7a
x86
save
F5 (build)
Edit: This solution has been reported as working on Visual Studio 2017 as well.
Edit 2: This solution has been reported as working on Visual Studio 2017 for Mac as well.
I'm posting an answer from another thread because it's what worked well for me, the trick is to add support for both architectures :
Posting this because I could not find a direct answer and had to look at a couple of different posts to get what I wanted done...
I was able to use the x86 Accelerated (HAXM) emulator by simply adding this to my Module's build.gradle script Inside android{} block:
splits {
abi {
enable true
reset()
include 'x86', 'armeabi-v7a'
universalApk true
}
}
Run (build)... Now there will be a (yourapp)-x86-debug.apk in your output folder. I'm sure there's a way to automate installing upon Run but I just start my preferred HAXM emulator and use command line:
adb install (yourapp)-x86-debug.apk
If you using Genymotion you need Installing ARM Translation and GApps
This is indeed a strange error that can be caused by multidexing your app. To get around it, use the following block in your app's build.gradle file:
android {
splits {
abi {
enable true
reset()
include 'x86', 'armeabi-v7a'
universalApk true
}
}
...[rest of your gradle script]
On Android 8:
apache.commons.io:2.4
gives INSTALL_FAILED_NO_MATCHING_ABIS, try to change it to implementation 'commons-io:commons-io:2.6' and it will work.
This solution worked for me. Try this,
add following lines in your app's build.gradle file
splits {
abi {
enable true
reset()
include 'x86', 'armeabi-v7a'
universalApk true
}
}
I know there were lots of answers here, but the TL;DR version is this (If you're using Xamarin Studio):
Right click the Android project in the solution tree
Select Options
Go to Android Build
Go to Advanced tab
Check the architectures you use in your emulator (Probably x86 / armeabi-v7a / armeabi)
Make a kickass app :)
i had this problem using bitcoinJ library (org.bitcoinj:bitcoinj-core:0.14.7)
added to build.gradle(in module app) a packaging options inside the android scope.
it helped me.
android {
...
packagingOptions {
exclude 'lib/x86_64/darwin/libscrypt.dylib'
exclude 'lib/x86_64/freebsd/libscrypt.so'
exclude 'lib/x86_64/linux/libscrypt.so'
}
}
this worked for me ... Android > Gradle Scripts > build.gradle (Module:app)
add inside android*
android {
// compileSdkVersion 27
defaultConfig {
//
}
buildTypes {
//
}
// buildToolsVersion '27.0.3'
splits {
abi {
enable true
reset()
include 'x86', 'armeabi-v7a'
universalApk true
}
}
}
The comment of #enl8enmentnow should be an answer to fix the problem using genymotion:
If you have this problem on Genymotion even when using the ARM translator it is because you are creating an x86 virtual device like the Google Nexus 10. Pick an ARM virtual device instead, like one of the Custom Tablets.
Visual Studio mac - you can change the support here:
this problem is for CPU Architecture and you have some of the abi in the lib folder.
go to build.gradle for your app module and in android, block add this :
splits {
abi {
enable true
reset()
include 'x86', 'armeabi-v7a'
universalApk true
}
}
In the visual studio community edition 2017, sometimes the selection of Supported ABIs from Android Options wont work.
In that case please verify that the .csproj has the following line and no duplicate lines in the same build configurations.
<AndroidSupportedAbis>armeabi;armeabi-v7a;x86;x86_64;arm64-v8a</AndroidSupportedAbis>
In order to edit,
Unload your Android Project
Right click and select Edit Project ...
Make sure you have the above line only one time in a build configuration
Save
Right click on your android project and Reload
In my case, in a xamarin project, in visual studio error removed by selecting properties --> Android Options and check Use Share run Times and Use Fast Deployment, in some cases one of them
In my case, I needed to download the x86 version of the application.
Go to https://www.apkmirror.com/
Search for the app
Select the first one in the list
Look at the top of the page, where is has [Company Name] > [Application Name] > [Version Number]
Click the Application Name
Click 'All Variants'
The list should contain an x86 variant to download
For genymotion on mac, I was getting INSTALL_FAILED_NO_MATCHING_ABIS error while installing my apk.
In my project there wasn't any "APP_ABI" but I added it accordingly and it built just one apk for both architectures but it worked.
https://stackoverflow.com/a/35565901/3241111
Basically if you tried Everything above and still you have the same error "Because i am facing this issue before too" then check which .jar or .aar or module you added may be the one library using ndk , and that one is not supporting 8.0 (Oreo)+ , likewise i am using Microsoft SignalR socket Library adding its .jar files and latterly i found out app not installing in Oreo then afterwards i remove that library because currently there is no solution on its git page and i go for another one.
So please check the library you are using and search about it if you eagerly needed that one.
In general case to find out which library dependency has incompatible ABI,
build an APK file in Android Studio (menu Build > Build Bundle(s)/APK(s) > Build APK(s)) // actual on 01.04.2020
rename APK file, replacing extension "apk" with extension "zip"
unpack zip file to a new folder
go to libs folder
find out which *.jar libraries with incompatible ABIs are there
You may try to upgrade version / remove / replace these libraries to solve INSTALL_FAILED_NO_MATCHING_ABIS when install apk problem
Just in case, this might help someone like me.
I had this same issue in Unity 3D. I was attempting to use the emulators from Android Studio.
So I enabled Target Architecture->x86 Architecture(although deprecated) in Player Settings and it worked!
In my case(Windows 10, Flutter, Android Studio), I simply created a new emulator device in Android Studio. This time, I have chosen x86_64 ABI instead of only x86. It solved my issue.
My emulator devices are shown in the screenshot below.
I faced this issue when moved from Android 7(Nougat) to Android 8(Oreo).
I have tried several ways listed above and to my bad luck nothing worked.
So i changed the .apk file to .zip file extracted it and found lib folder with which this file was there /x86_64/darwin/libscrypt.dylib so to remove this i added a code in my build.gradle module below android section (i.e.)
packagingOptions {
exclude 'lib/x86_64/darwin/libscrypt.dylib'
exclude 'lib/x86_64/freebsd/libscrypt.so'
exclude 'lib/x86_64/linux/libscrypt.so'
}
Cheers issue solved
Hi if you are using this library;
implementation 'org.apache.directory.studio:org.apache.commons.io:2.4'
Replace it with:
implementation 'commons-io:commons-io:2.6'
And the problem will be fixed.
This happened to me. I checked the SDK Manager and it told me the one I was using had a update. I updated it and the problem went away.
Quite late, but just ran into this. This is for Xamarin.Android. Make sure that you're not trying to debug in release mode. I get that exact same error if in release mode and attempting to debug. Simply switching from release to debug allowed mine to install properly.
In my case setting folowing options helpet me out
Somehow, this fix the issue out of no reason.
./gradlew clean assemble and then install the app.
I need to update an existing app on the Play Store. For this reason, since August, Google has requested to provide 64-bit versions as well.
I have included the instructions provided in the build.gradle app as follows:
compileSdkVersion 28
defaultConfig {
applicationId "com..."
minSdkVersion 24
targetSdkVersion 28
versionCode 10
versionName "1.5"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
ndk {
abiFilters 'arm64-v8a','x86_64','armeabi-v7a','x86'
}
}
and:
splits {
abi {
enable true
reset()
include 'arm64-v8a','x86_64','armeabi-v7a','x86'
universalApk true
}
}
I am able to generate the APK as expected, but unfortunately both arm64-v8a and x86_64 versions do not contain any 64-bit code.
There is no lib directory when analyzing the APK in Android Studio while the APK armeabi-v7a includes lib / libarm_arch.so.
Note no error message is shown by the compilation process.
Can a dependency cause this problem and why can't Android Studio show an error message?
How can I identify why the 64-bit version is not generated?
I'm using Android Studio for 3.5.
After searching about the libarm_arch.so library, I have found that it's linked to FFMPEG. But FFMPEG is not referenced in my Gradle dependencies and I have not still found how to tell to Android Studio to embed the arm68-v8a version of the library as well.
Thanks for your help.
I had the same problem, I've converted a project of 2 years ago to latest Android Studio, now I need to generate the 64bit, but APK built and Bundle do not generate 64 bit output.
I found out I had a directory which was causing this incompatibility:
app/src/main/jniLibs (this one had /armeabi /armeabi-v7a /x86 subdirs in it)
I fixed it by deleting the directory jniLibs.
How can I identify why the 64-bit version is not generated?
from https://developer.android.com/distribute/best-practices/develop/64-bit#64-bit-libraries
In a typical case, an APK or bundle that's built for both 32-bit and 64-bit architectures will have folders for both ABIs, each with a corresponding set of native libraries. If there's no support for 64-bit, you'll likely see a 32-bit ABI folder but *not a 64-bit folder*.
Edit:
if your read just one the same link
https://developer.android.com/distribute/best-practices/develop/64-bit#port-32-to-64
you will confirm if you are really making any change on your code to be able to port 32 to 64
you could be doing the right step on the gradle , but not in the code.
i can't say anything more if you don't provide a sample
Android Studio don't have anything to complains if you keep your code on 32 and try to build to 64, it just keep your 64 folder build result empty as a point on my first response
I hope that helps :)
I've got a message from Google saying that after August, 1 2019 all the apps using native code should be published as 64-bit versions, not only as 32-bit versions, otherwise any further updates will be rejected.
My GluonMobile-based app was listed as having only 32-bit libraries. APK Analyzer shows a group of .so files under \lib\armeabi which, as far as I understand, are those libraries:
libjavafx_font_freetype.so
libjavafx_iio.so
libdecora_sse.so
libprism_common.so
libprism_es2_monocle.so
libglass_monocle.so
libactivity.so
libwebview.so
libjavafx_font.so
There are some instructions available at google (https://developer.android.com/distribute/best-practices/develop/64-bit#building_with_android_studio_or_gradle) but I'm not sure where to put this config (in what portion of GluonMobile app's build.gradle file, if it's applicable in this case at all).
What exactly should I do in order to make the GluonMobile app compatible with the new Google policy?
The jfxmobile plugin has just been updated to provide support for 64 bits libraries, you will need to upgrade your projects to use version 1.3.17.
Alternatively, if you want to keep an older version of the plugin you can do:
jfxmobile {
javafxportsVersion = '8.60.12'
...
}
But if you create a new project with the Gluon plugin for your IDE, now you will get:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.javafxports:jfxmobile-plugin:1.3.17'
}
}
...
Then if you run ./gradlew android or ./gradlew androidInstall, you will get your apk with a lib folder like:
lib
|-- arm64-v8a
|-- armeabi-v7a
so support for 32 bits and 64 bits is granted now.
Note that having two sets of libraries will increase the size of the apk in 2.5 MB.
two weeks ago I uploaded a new version of my Android app to the Developer Console to run an Alpha Test. However I was not able to download this test version on my test device, since the Play Store offered no such update to my test user.
After I was not able to solve this issue here I contacted the Google Developer Support directly.
I now received the following reply:
I’ve looked into your issue and found that your app's Version 15 is not compatible with the Nexus 5 due to a conflict in your app’s manifest with the following native platforms: armeabi, armeabi-v7a.
For more information about platforms, visit our developer site at https://developer.android.com/ndk/guides/abis.html
This is quite confusing. As far as I understand the information on the linked page, the ABI setting is only available/relevant when working with the NDK. However I am working with the latest SDK version in Android Studio 2.1
Is it even possible to set/define the ABI version when working with the SDK?
The App Manifest does not include any settings related the the ABI version.
When I copy the APK manually to my device (Nexus 5 running Android 4.4.4) and install it, it runs without any problem. So, is the APK really not compatible with my device?
EDIT:
Inspired by the the comment by user1056837 I found this page, that describes how to add an NDK block to the build.gradle file:
android {
...
ndk {
// All configurations that can be changed in android.ndk.
...
}
productFlavors {
create("arm") {
ndk {
// You can customize the NDK configurations for each
// productFlavors and buildTypes.
abiFilters.add("armeabi-v7a")
}
}
create("fat") {
// If ndk.abiFilters is not configured, the application
// compile and package all suppported ABI.
}
}
}
Currently my build.gradle file does NOT include any NDK configuration. I am not sure, how I could solve the problem with the Play Store by adding such config.
As far as I understand the information on the linked page, a fat binary will be created of no abiFilters are configured. Is that correct?
Then one of the following should be correct:
My project does contain some native code without my knowledge. In this case a fat binary is created since my build.gradle file does NOT include any NDK configuration.
My project does not contain any hidden native code. In this case the NDK config would not have any effect at all.
Did I miss something here? No matter which case is correct, in both scenarios I do not know what config would solve the problem...
Maybe it is to late, but nevertheless:
I had the same problem. It was in third-party libraries. When my application started to build, the library bitcoinj created a native script in the /lib/x86_64/darwin/libscrypt.dylib folder. I just excluded this folder in the build.gradle file.
packagingOptions {
exclude 'lib/x86_64/darwin/libscrypt.dylib'
}
After that all started work fine. My app support 5900 devices now.