Add x86 support to an apk - android

First of all I'm not an android dev
I have an apk which only supports arm.
I decompiled it with apk tool.
And now i have it as smali files.
Can this be compile with x86 abi support by building it again with gradle in android studio?
Or is there any other way to add x86 support to that apk?

that depends on native code/libs used in your project, but generally you can build an x86 apk in Android Studio. there is no way for "migrating" arm APK to x86 (or any other) without sources and building whole up again. some clues HOWTO in HERE (abiFilters 'x86') and/or HERE (include "x86")

Related

Flutter large apk size and releasing for different ABIs

I am trying to build a release app with low file size in Flutter. Yesterday the release apk size was around 16mb, but after I updated the flutter, the size goes to 23mb.
After some researching, I fount out that flutter generates app bundle with all of the ABIs in it and after the update, new API has been added to apk.
After adding app to android studio apk analyzer, I can see the different ABIs in them as below:
x86_64 7.1mb
arm64-v8a 7mb
armeabi-v7a 6.8mb
I can use flutter build apk --split-per-abi to generate apks for different ABIs.
Now the question is, can a arm64-v8a system run x86_64 apk? (or the otherwise).
Or can any of these ABI apk releases, be run in all the devices?
I don't release my app on app stores, I just put it on my clients website and their clients will download it from there (or it will be sent to them by email, ... ). So I need one release that works in all of the android devices and the full bundle release is way too large (23mb).
EDIT:
I just tested x86_64 build on a arm64-v8a device and it did not install. but the armeabi-v7a version did install.
I did some research and tried the release versions on different devices and this is the result:
The command is : flutter build apk --split-per-abi
The x86_64 apk version does not work on any other devices. I could not find an x86_64 device but I assume it will work on x86_64 devices!
The arm64-v8a apk version gets installed on arm64-v8a but it will not install on armeabi-v7a devices. (armeabi-v7a is older than
arm64-v8a).
armeabi-v7a apk version works on armeabi-v7a and arm64-v8a devices. I did not find an x86_64 device but I think it will work on this
device too.
Summary: The newer version of the ABI can run the older apk builds. The order is: armeabi-v7a then arm64-v8a then x86_64.
For example, armeabi-v7a will install and work on all of the devices and if you build and arm64-v8a apk, it will NOT install on armeabi-v7a devices.
There are other architectures that are no longer used (mips, mips64, armeabi) and Flutter by default, will not contain them in builds.
the X86 and X86_64 architectures are for very limited number of devices, but may be useful for debugging in the emulator.
This was the result of my researches and testings. I decided to only use the armeabi-v7a so the apk size will be 8mb instead of 23mb.
If someone else having this question/trouble, I hope this helps :).
Write this command on the cli of your vscode or android studio to build a 3 version of your flutter android project:
flutter build apk --target-platform android-arm,android-arm64,android-x64
https://flutter.dev/docs/deployment/android
https://cloud.tencent.com/developer/article/1661684

Play Store 64bit apk with 32bit dll

I have Unity project with DLL prepared for architectures: x86, x86_64, armeabi-v7a.
I haven no possibility to convert DLL to architecture arm64-v8a.
However if I build apk for armeabi-v7a only, it works on 64bit device.
But for Google Store I need to build it with arm64-v8a compatibility - this version of application doesn't work because there is error that 64 bit DLL not found.
Is there any possibility to solve this problem?
Maybe there is some possibility to modify apk file after build?
Thanks in advance for help.

Android Studio : Missing Strip Tool

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/**"
}
}

how to find that the Android app is 32bit or 64bit

I am new to android. And i don't know how to get the info about android apps.
Can anyone please suggest that how one can find that the android app running is 32bit or 64 bit?
Thanks
APKs are not 32-bit or 64-bit. NDK binaries (.so files) inside of APKs will be compiled for specific CPU architectures. Generally, 32-bit binaries should work fine on 64-bit CPUs.
APK is ZIP. You can open it and check directory lib to see which architectures are supported. If there is no directory lib, it supports all architectures.
https://developer.android.com/ndk/guides/abis.html

how to build the project for intel x86 emulator instead of armeabi v7?

I am beginner in android,
I have successfully built the android demo with bazel. Now I am trying to work with it in Android studio.
I found this repository here.
It currently works well with armeabiv7 but crashes with intel x86 emulator.
But I want to build it for intel x86 and x86_64 and I want to build it in Android studio using gradle what should I do? Please help me
I am using
NDK 10re,
Android Studio 2.0,
UBUNTU 14.04
as you see in this location of repo:
https://github.com/miyosuda/TensorFlowAndroidDemo/tree/master/app/src/main/jniLibs
there are only libraries for armeabi-v7a thus it will not work on x86 emulator
from what is available on this repo, i see there is also jni code code for that libraries. Unfortunately there are dependencies and are also available here only for armv7 platform. To make this work it will require a lot of work, mainly searching for proper working x86 libraries/dependecies or building them by yourself.

Categories

Resources