Raulp
Raulp

Reputation: 8146

Target exe for Android ABI(ndk build)

I have an android system with two different CPU ABI - armeabi-v7a and x64 .For which one I have to build the application code to get it working.My application (in c language) anyway doesnt run for either of the platforms. OR is there any common tool chain with which I can build the same. arm-eabi-gcc?

Upvotes: 0

Views: 1866

Answers (2)

ph0b
ph0b

Reputation: 14463

The NDK contains all the toolchains you need to run your program on Android platforms.

To setup the architectures you need to compile to, you should set the APP_ABI variable inside Application.mk or pass it to the ndk-build command.

APP_ABI:=all will make your ndk project being built for all the supported architectures: armeabi, armeabi-v7a, arm64-v8a, x86, x86_64, mips, mips64.

You can also list which architectures you want to build for: APP_ABI:= x86_64 x86 armeabi-v7a arm64-v8a and also use all32 and all64 as shortcuts to all the 32-bit and all the 64-bit architectures.

To determine which platforms are supported by a target device, you can call adb shell getprop ro.product.cpu.abi (preferred arch) and adb shell getprop ro.product.cpu.abi2 (second arch).

Starting with Android 5.0, use adb shell getprop ro.product.cpu.abilist instead, that returns a list of all the supported ABIs, sorted in preference order.

Upvotes: 5

fadedreamz
fadedreamz

Reputation: 1156

I don't think you can target completely different architecture (arm and x86) with android provided ndk (cross-compilers). You can target multiple ABI supported by arm with following variable

TARGET_ARCH_ABI

possible values are:

armeabi For ARMv5TE 
armeabi-v7a

for more details you can check this link.

To run in x86 or amd64 system you can normally use a gcc to create the .so file and use JNI to test functionally (remember Android F/W will be unavailable there).

If you are looking for rapid building-testing cycle I think it's better for you to use an x86 based emulator like AndroVM (now Genymotion). In that way you can write code for android device and test it real quick.

Upvotes: 0

Related Questions