Linda Lowela Linda Lowela - 8 months ago 96
C++ Question

Googletest for Android NDK

I checked a previous answer about unit test for Android, where it is suggested Googletest as a good option. However, I got a look into the Google C++ Testing Framework - Googletest. About platforms, I don't see anything mentioning support to Android. Could someone tell anything, if there is some way of using it with Android devices - e.g. steps to build a toolchain, etc?


You need to built Googletest for Android to be able to run it with your toolchain, as you working with cross-compilation.

Download source code of googletest

$ mkdir googletest
$ cd googletest
$ svn checkout .

Copy jni directory to googletest directory

$ cd /path/to/this/git
$ cp -r jni googletest/

run ndk-build script

$ cd googletest/ $ ndk-build 

You can find libgtest.a in googletest/obj/local/armeabi/libgtest.a

Source: sfuku7 / googletest_android_ndk-build - github