After generating coverage data for your code, gcov can be used to create a report that shows the number of times each line is executed. lcov is a graphical front-end for gcov and can also be used. Personally, I much prefer lcov's HTML output, so that's what I'll use here.

  1. Assuming you've run your app, and the .gcda files have been created in a folder called coverage_data:

    adb pull /sdcard/coverage_data /home/davide/my_project
  2. Move the .gcda coverage files into the same folder as your obj files:

    mv coverage_data/*.gcda obj/local/x86/objs-debug/my_native_library
    rmdir coverage_data
  3. Generate the coverage report:

    lcov --capture --directory obj --base-directory ./ --output-file coverage.info --no-external
    lcov --remove coverage.info "C:/*" -o coverage.info
    genhtml coverage.info --output-directory out
  4. Since I build on Windows, I exclude any file on C:\ (which is where I have the NDK installed). If you're building on a variant of Linux, you may need to modify or remove the second line.

    Once the command has completed, the report will be in out/index.html.