polyqosa.blogg.se

Android studio debug configuration android native
Android studio debug configuration android native







android studio debug configuration android native

Android Studio does not support local C++ debugging (in our case, on macOS) so we initially had no way to debug our C++ code in these tests without porting them to instrumentation tests first. We have an extensive suite of JUnit unit tests sprinkled with some Robolectric (for more on this, see the Rendering Tests Using Robolectric blog post). The same technique can be used to debug your instrumentation tests: just set up their run configuration to have access to your native library debugging symbols. Thankfully, this is easily fixable by pointing Android Studio to the proper debugging symbols, as shown below. However, this integration doesn’t work with our setup, as we use a custom CMake build for our native libraries.

android studio debug configuration android native

See this information about integrating a C++ build with Gradle for more details. C++ debugging works out of the box in Android Studio when using native build integration in the Android Gradle Plugin.

android studio debug configuration android native

Debugging Android ApplicationsĪndroid Studio provides basic C++ debugging capabilities with full support for the LLDB debugger. Using the same approach on other platforms and/or debuggers should work in a similar fashion, but this is left for you to discover. We’ll use the LLDB C++ debugger, as it’s the preferred option for macOS users, and it is also used by NDK. Note that our primary platform for development is macOS, and the steps we outline in this article have only been tested on macOS. I’ll present some of our findings in this article. As you might imagine, this got tiresome quickly, so we spent some time experimenting with various ways of debugging our NDK code via the C++ debugger. However, this was a labor-intensive process, and it required recompiles of the app whenever a new log was added. Until recently, we used logs to understand complex flows in our code. Sometimes our C++ code does not behave as it should on Android. On Android, we use the Native Development Kit (NDK) to compile our codebase into a shared library ( libpspdfkit.so) that handles most of our business logic. At PSPDFKit, we work with a very large C++ codebase that is shared between our various platforms - the PDF specification is large, and there are many edge cases that need special treatment.









Android studio debug configuration android native