I am constantly getting this warning while building my android studio code using terminal command gradle clean assembleRelease:
Unable to strip library 'lib.so' due to missing strip tool for ABI 'ARMEABI'. Packaging it as is.
Please help me on how to get this warning resolved.
Note: I know this won't affect the behaviour of my app, but my APK is too bulky and this will surely help me reduce APK size. So I need this resolved.
The default installed NDK doesn't seem to have the tools required to strip binaries that have been built with ARMEABI support, so it ends up packaging the whole library, which increases the built file size substantially.
I've found that installing the "NDK (Side by side)" tool from Android Studio -> Tools -> SDK Manager -> SDK Tools takes care of this warning and also reduces the built APK size, especially for React Native projects.
Steps to install NDK (Side by side)
Open Android Studio
Click Configure/ Tools
Click SDK Manager
Click SDK Tools tab
Select below:
NDK (Side by side)
CMake
Android SDK Command-line Tools (latest)
Apply
NOTE: Android SDK Command-line Tools (latest) is not needed but I installed it so that I don't have to search for more solutions, today has been a lot of troubleshooting to run a new React Native app.
More info: https://developer.android.com/studio/projects/install-ndk
You can try using the following configuration in app/build.gradle.
android {
packagingOptions {
// exclude ARMEABI native so file, ARMEABI has been removed in NDK r17.
exclude "lib/armeabi/**"
}
}
Remove (or make optional) MIPS native library #3504
Android-ABIs
A possible solution specifically for React Native:
I got this problem when trying to build my React Native application from the command line by executing cd android/ && ./gradlew assembleDebug (without having Android Studio open).
I opened Android Studio, I built the app there and it automatically fixed the problem. Once I tried again by command line the problem was not happening anymore.
I'd like to combine all the existing answers and add some more explanation/details.
First of all, just like other people mentioned, check that you have Android NDK installed (NDK (Side by side) in Android Studio -> Tools -> SDK Manager -> SDK Tools). But it's still not enough to fix this warning.
There's a list of supported ABIs by Android NDK and it has a note saying that 'armeabi' is no longer supported:
Historically the NDK supported ARMv5 (armeabi), and 32-bit and 64-bit MIPS, but support for these ABIs was removed in NDK r17.
So, if your app needs to support ARMv5/6 devices (which is unlikely - those are pretty old), you should either:
Use older NDK <r17 that supports 'armeabi' ABI (choose another version in SDK Manager)
Ignore the warning. In this case, the library will still work on older devices even with newer NDK but will be packed in APK for every ABI, including the newer ones (which leads to increased APK size)
If there's no need in supporting ARMv5/6, you might still want to support ARMv7 ABI 'armeabi-v7a'. Once again, there are two options:
Recompile the shared library with a newer Android NDK that supports 'armeabi-v7a' ABI
(Not recommended) Rename 'armeabi' folder to 'armeabi-v7a' (I'm not sure whether libraries for these ABIs are compatible or not)
If the library doesn't belong to you, you should probably ask its maintainer to fix it.
But if there's no need in supporting even ARMv7, feel free just to exclude the libraries:
android {
packagingOptions {
exclude "lib/armeabi/**"
}
}
Related
Android Studio Tips
I have some ndk in SDK_ROOT/ndk dir, but Android studio can't recognize them.
I have to download a new one. Is there some difference between SDK_ROOT/ndk with SDK_ROOT/ndk-bundle
"ndk-bundle" is the one that's included with Android Studio, whereas "ndk" is the standalone one
ndk-bundle is referred to as the ndk shipped as part of Android Studio.
whereas in ndk you can have any number of ndk of different version.
Doing so helps you ensure reproducible builds across projects that each depend on a specific version of the NDK.
I am trying to install NDK in Android Studio 3.2.1 and I am following the procedure described here
It says I need to select LLDB, Cmake and NDK form the list in the SDK Manager,but I can only see LLDB and NDK in my computer, and CMake is absent
What do I need to do to install CMake and start coding using C? Or is installing just LLDB and NDK enough?
According to the docs on developer.android site:
Android Studio supports CMake, which is good for cross-platform projects, and ndk-build, which can be faster than CMake but only supports Android. Using both CMake and ndk-build in the same module is not currently supported.
You can only use one of the Cmake or NDK(as you see NDk is better but only developed for Android).
here is link of documentation for more info.
If you still have problem with installing cmake by sdk manager, make sure you are using 64 bit version of android studio.
for more information about how you can install Cmake or NDK you can see this answer
I am trying to build an old project and something has changed where the project tries to target mips64el-linux-android. I don't reference this build targets within in build variants and it's not the sdk build version I specify in the project properties panel. Even so, I do have the native sdk installed so it should build in this case.
Any ideas?
1.Donwload NDK package
2.Open the "toolchains" folder after unzipping
3.Compare with android-sdk->ndk-bundle->toolchains folder
4.Find the missing folder and copy it in the past
5.Recompile
Which NDK version are you using? Google has dropped mips support in NDK r17.
You need to download older NDK for older projects. I use NDK r10e and sometimes r14 for my older projects. If project is too old you can try with r10.
In your project build script you need to specify downloaded NDK's path. You need to download and manually extract NDK (I believe Android Studio will not download older version).
I have an android library project that builds lib.aar artefact and an app project that imports this lib.aar after it was built. lib.aar requires NDK 17 to be built since it has some C++ 17 code.
I manage to build .aar file successfully but the app fails to compile with this message:
A problem occurred starting process 'command '/Users/user/Library/Android/sdk/ndk-bundle/toolchains/mips64el-linux-android-4.9/prebuilt/darwin-x86_64/bin/mips64el-linux-android-strip''.
This is caused by the fact that NDK 17 removed support for MIPS and I can't upgrade to a newer version of android studio that uses NDK 18beta
If I remove the content of '/Users/user/Library/Android/sdk/ndk-bundle' folder, deleting the NDK, then the app builds without errors and I can use lib.aar code inside the app.
So far I've tried this: How do I disable the NDK build in Android Studio 1.0.1 , this https://gist.github.com/ph0b/9e59058ac59cac104398 . Setting env variable ANDROID_NDK_HOME to a dummy folder works, the app builds, but it's kind of a hack.
Is there any way to programmatically disable NDK build for the app project without deleting NDK folder?
This is caused by the fact that NDK 17 removed support for MIPS and I can't upgrade to a newer version of android studio that uses NDK 18beta
r18 won't fix this problem either; it still doesn't have mips support. The fix to the problem is upgrading the gradle plugin version in your application to at least 3.1, which is the minimum required for NDK r17 (and, extremely unfortunately, is required for even having the NDK installed for some reason).
The other solution here would be to install NDK r16b somewhere and then point at it from the app's local.properties, letting the aar pick from the SDK. If you're just working on a local build this will work, but since local.properties shouldn't be checked in to version control it won't help others much.
I recently installed Qt5 and works like a charm for API 17 and armeabi-v7a.
But I added second AVD with other parameters (of course, I installed packages in AVD settings). Now, I can't compile first project and new project for API10. When check any toolchain (armeabi or armeabi-v7a), window for choose AVD says that I don't have compatible AVD (in message displays that AVD supports default/armeabi or default/armeabi-v7a).
Anyone know how I can repair this? I think that problem is with "default/"...
There seems to be another workaround for this problem:
In QtCreator -> Projects -> BuildEnvironment add the variable
ANDROID_TARGET_ARCH=default/armeabi-v7a
Then the AVDs are shown as compatible.
It turns out that this is indeed a changed behaviour in the latest version of the Android SDK, where it lists AVDs with prefixed tag information. So instead of armeabi-v7a it's returning default/armeabi-v7a, resulting in QtCreator complaining that the ABI is not supported.
Here is the QtCreator bug report: https://bugreports.qt.io/browse/QTCREATORBUG-11658
You can either wait for a new QtCreator to be released after the patch goes in (it's being reviewed at the moment), or you can try to downgrade your Android SDK Tools from version 22.6 to something that reports only ABI: armeabi-v7a instead of Tag/ABI: default/armeabi-v7a when you execute android list avd
Spent some time figuring out how to downgrade from Android SDK Tools 22.6. Here's how to downgrade:
Download Android SDK Tools 22.3
Rename tools-folder to tools-22.6 under SDK (eg. ~/adt-bundle-linux-x86_64-20131030/sdk/tools)
Extract the downloaded tools to above path