TYPE ARM5/6** ARM7 ARM8 X86 X86_64 MIPS*** armeabi ✓ ✓ ✓ ✓ ✓ armeabi-v7a ✓ ✓ ✓* ✓ arm64-v8a ✓ x86 ✓ ✓ x86_64 ✓ mips ✓ * via libhoudini, slower and buggy ** obsolete architecture, not used anymore *** no known consumer devices
tips • Minimize JNI calls (remember, slow!) • Keep strings in UTF-8. • Keep threading in Android / avoid native threads - keep calls synchronized. • APIs can be exposed both ways (Java -> C++ and C++ -> Java), use it!
testing • Compile binary in debug mode (-g !) to show stack trace in logcat. • Use ndk-stack to resolve addresses to line numbers. • Path is the path to JNI compilation ‘obj’ directory with unstripped binaries. adb logcat | ndk-stack obj/local
No good support at all - XCode Instruments still the best tool. • nVidia Tegra Profiler is the only working one - needs a (rooted) Tegra device. https://developer.nvidia.com/tegra-system-profiler
• Minimize cross-language calls. • Use modern C++14 and use it wisely. • Never link against system libraries. • Offload heavy dependencies (regex, charsets, crypto) to platform libraries.
• Don’t rely on C++ UTF implementation - use miniUTF or platform APIs. • Be conservative with dependencies - “smart” libraries will break. • Link everyting in a single static .so library. Dynamic linking is full of issues on Android.