Android Studio with ndk and googletest
Asked Answered
C

0

2

I'm trying to setup my CI server to work with Android Studio. I'm looking to run my unit tests for the NDK through the new UI. I'm using GoogleTest and gcov works beautifully for the code coverage when I build from the command line. The problem I'm running into is that the test configuration that's in the UI works for java, but doesn't add any commands to the gradle build scripts. Thus I can't figure out where to add my commands.

This is the source I got the info on how to setup Unit Tests within Android Studio: http://rexstjohn.com/unit-testing-with-android-studio/

So here's the question: If I were to place something like this:

    android {
         defaultConfig {
            testPackageName "com.test.foo"
            testInstrumentationRunner "android.test.InstrumentationTestRunner"
            testHandleProfiling true
            testFunctionalTest true
            ndk {
               moduleName "LexAppNative"
               stl "stlport_shared"
               abiFilters "armeabi-v7a"
            }
        }
        buildTypes {
           debug {
                ndk {
                     ldLibs "log -L/absolute/path/to/libs", "z", "m", "GLESv2", "OpenSLES", "opencv_java", "libgtest.a --coverage"
                     cFlags "-I/absolute/path/to/libs/includes", "--coverage"
                }
           release {
                ndk {
                    ldLibs "log -L/absolute/path/to/libs", "z", "m", "GLESv2", "OpenSLES", "opencv_java"
                    cFlags "-I/absolute/path/to/libs/includes"
                }
           }
       }
    

Will that give me what I want?

Chiarra answered 15/1, 2015 at 20:44 Comment(2)
possible duplicate of Android studio, gradle and NDKFraudulent
I agree that there are aspects of my question that is similar (i.e. NDK and Android Studio are certainly part of this). However, my question has more to do with running unit tests. If you refer to the question, I'm asking about the problem that I can't find where in the gradle script the "testing" activity is created. I'd like to be able to have it call my NDK build and run the googletests in C++ whenever I run a unit test compile.Chiarra

© 2022 - 2024 — McMap. All rights reserved.