Unit Test project for Native Android libraries? RRS feed

  • Question

  • Is there a way to Unit Test Android library projects (C++, Andriod NDK)? 
    Saturday, June 4, 2016 9:03 PM


  • Hi Nihav Jain,

    According to your description, I create an android libraries project and a Unit test project under Visual C++ Templates.
    When I added android libraries project to the reference of unit test, and the VS report the
    Error Message  ”A reference to ‘***’ cannot be added because the two project target different platforms”.  Right-click the unit test, choose “Propertries”, we can find the target platform is “Windows”.
    So the current version of VS is not support the unit test for android libraries.

    If you want to unit test the android libraries, I suggest you unit test the C++ project because Visual Studio supports common C++ library, and then integrate all methods that have been tested to android libraries project.

    Document about unit tests for C/C++ could refer to the following hyperlinks:

    Best Regards,

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Proposed as answer by Weiwei Cai Tuesday, June 14, 2016 8:14 AM
    • Marked as answer by Weiwei Cai Wednesday, June 15, 2016 1:06 AM
    Monday, June 6, 2016 9:30 AM