Phonon Phonon - 1 month ago 19
Android Question

How to use ARM Assembly code in an Android project?

I'm not particularly experienced with Assembly and ARM, but I was able to write a few routines in it and I'd like to see how they run on an ARM-equipped Android device (Nexus S). What is the procedure for including an Assembly code file into an Android project? Can I only call it from native code, or from Java also?

Answer

You can call assembly from Android using the Java Native Interface and the Android NDK.

Cedric mentions using the asm keyword, while I prefer to include assembly source code. I have posted a tutorial to do this at my site: http://www.eggwall.com/2011/09/android-arm-assembly-calling-assembly.html

You can download the source code for my example and see how it works. Once you see a functioning example, it is easy to modify it to your needs.