Android Studio not stopping on breakpoints in C++ code on older API

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Android Studio not stopping on breakpoints in C++ code on older API

btanguay
Hello everyone!

I do not know yet if this is a real bug or a misconfiguration issue on my part which is why I post it here. Hopefully someone can help shed some light on my issue.

General problem

I have an Android Native application that targets two different API versions: 23 (Marshmallow) and 28 (Pie). For the API 28, I have no problem debugging a hello world application when it enters the C++ code: the debugger attaches itself and stops the execution at my breakpoints. For the API 23 however, the debugger attaches itself but never stops at the breakpoints. This behavior for both APIs is consistent across emulators and real devices.

Expected behavior

I would expect the debugger to stop on breakpoints no matter the API used.

Actual behavior

For API 23 at least, the debugger ignores the breakpoints present in C++. The problem doesn't manifest itself when an emulator or real device uses a more recent API such as 28.

Versions
  • Windows 10
  • Android Studio 4.1.1
  • Gradle 6.5
  • NDK 21.1.6352462
  • CMake 3.10.2.4988404
  • Java 8.0.265-open
Emulators comparison
API 23
  • Galaxy Nexus 4.65 720x1280
  • Android 6.0 x86_64 (Marshmallow)
API 28
  • Galaxy Nexus 4.65 720x1280
  • Android 9.0 x86_64 (Pie)

The only difference here is really the operating system. Everything else including memory allocation seems to be exactly the same.

Code

The code is the same in both cases. It pretty much follows the default JNI template provided by Android. I'll post everything in any case.

Root build.gradle

Application build.gradle

CMakeList

C++ file called through JNI (this is where the breakpoints don't work!)

Reference to a repo demonstrating the problem

https://github.com/BenjaminTanguay/android-studio-breakpoint-failure

I have confirmed with a work colleague that the problem can be repeated on his environment. However, I don't know yet if the problem is environment specific (maybe it works with different versions of software), configuration specific (perhaps I made a mistake somewhere) or is a real bug in the Android tools.

If anyone can help, I would be very grateful.


Note: This post is somewhat of a copy of the stackoverflow question found here:

https://stackoverflow.com/questions/64936460/debugging-c-native-code-in-android-studio-doesnt-work-with-older-android-sdk

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/62771b58-bef7-43d7-9722-74170d1ea9fcn%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Android Studio not stopping on breakpoints in C++ code on older API

Alias R. Cummins
Is your IDE connecting to ADB?

On Mon, 23 Nov 2020 at 23:46, btanguay <[hidden email]> wrote:
Hello everyone!

I do not know yet if this is a real bug or a misconfiguration issue on my part which is why I post it here. Hopefully someone can help shed some light on my issue.

General problem

I have an Android Native application that targets two different API versions: 23 (Marshmallow) and 28 (Pie). For the API 28, I have no problem debugging a hello world application when it enters the C++ code: the debugger attaches itself and stops the execution at my breakpoints. For the API 23 however, the debugger attaches itself but never stops at the breakpoints. This behavior for both APIs is consistent across emulators and real devices.

Expected behavior

I would expect the debugger to stop on breakpoints no matter the API used.

Actual behavior

For API 23 at least, the debugger ignores the breakpoints present in C++. The problem doesn't manifest itself when an emulator or real device uses a more recent API such as 28.

Versions
  • Windows 10
  • Android Studio 4.1.1
  • Gradle 6.5
  • NDK 21.1.6352462
  • CMake 3.10.2.4988404
  • Java 8.0.265-open
Emulators comparison
API 23
  • Galaxy Nexus 4.65 720x1280
  • Android 6.0 x86_64 (Marshmallow)
API 28
  • Galaxy Nexus 4.65 720x1280
  • Android 9.0 x86_64 (Pie)

The only difference here is really the operating system. Everything else including memory allocation seems to be exactly the same.

Code

The code is the same in both cases. It pretty much follows the default JNI template provided by Android. I'll post everything in any case.

Root build.gradle

Application build.gradle

CMakeList

C++ file called through JNI (this is where the breakpoints don't work!)

Reference to a repo demonstrating the problem

https://github.com/BenjaminTanguay/android-studio-breakpoint-failure

I have confirmed with a work colleague that the problem can be repeated on his environment. However, I don't know yet if the problem is environment specific (maybe it works with different versions of software), configuration specific (perhaps I made a mistake somewhere) or is a real bug in the Android tools.

If anyone can help, I would be very grateful.


Note: This post is somewhat of a copy of the stackoverflow question found here:

https://stackoverflow.com/questions/64936460/debugging-c-native-code-in-android-studio-doesnt-work-with-older-android-sdk

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/62771b58-bef7-43d7-9722-74170d1ea9fcn%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/CAP5h4q-r-Vy3KWWbtimgX4u86BKn_fHR%2B%3DqEo%2BM-h9up6dToPw%40mail.gmail.com.