This example demonstrates how to :
- generate a library containing a procedure written in ARMv7 GNU ASsembly
- call this procedure from a Android app using the JNI
- use the returned value in the Android app and display it
- GNU AS
- Gold linker
- An ARM Android phone/emulator on which you have installation privileges
Run make
from this folder
Run the following commands :
# cross compiler prefix. Remove if you're assembling from an ARM machine
export PREFIX="armv7a-hardfloat-linux-gnueabi"
export DEST="./apk/app/src/main/jniLibs"
$PREFIX-as -o wild.o wild.s
$PREFIX-ld.gold -shared --dynamic-linker=/system/bin/linker -shared --hash-style=sysv -o libwildAssembly.so wild.o
cp libwildAssembly.so $DEST/armeabi/libwildAssembly.so
cp libwildAssembly.so $DEST/armeabi-v7a/libwildAssembly.so
- The Android NDK path in your system's PATH directory
Open a shell or a command window in this folder and :
- On Windows, run 'mkbuild'
- On Linux, run 'mkbuild.sh'
- Connect your ARMv7 Android phone/emulator
- open a shell or a "command window"
cd
to the apk folder
Then :
- On Windows run
gradlew installDebug
. - On Linux run
./gradlew installDebug
Connect your ARMv7 Android phone/emulator and run ./gradlew installDebug
from the apk folder.