Failed to set breakpoint on Android Studio?

Hey,I think I’m running in this issue nearly every month, and I’m still not really sure what the issue is for this, and I’m also unsure what the fix was the last time since it seems like the issue is different every time.

For some reason, I’m unable to hit breakpoints in my Debug build for Android when starting it with the debugger.

It simply ignores my breakpoints even though it successfully waits for the debugger.

I can see following warning in the console "warning: failed to set breakpoint site at 0xea519150 for breakpoint 3.1: error: 0 sending the breakpoint request" but I couldn’t find anything about this so far.

I think I haven’t really updated anything since the last time the breakpoints worked, except for my phone OS. Going back to my notes for debug issues, the last time a sdkbox update did work but I’m alread on the last version now, so it has to be something different this time.

I’m on the latest ndk,sdk, etc version (maybe this is the issue ?, even though the debugger worked just fine on those version a month ago lol)

let me know if anyone has any ideas.

Hoped this will fix itself with 3.17.1 but it didn’t.
Still have no idea why breakpoints suddenly don’t work anymore.
I thought the ndk version might be an issue, but I’ve tried all versions from r19 - r16.

If anyone has any idea, please let me know

I’ve recently switch everthing to CMake, so maybe thats the issue?
Maybe I’m adding the incorrect symbols?

@Sleicreider It may be that optimizations haven’t been turned off, which means you won’t be able to set breakpoints on sections of code. Try adding this to your CMakeLists.txt file (the one in the root folder of your game):

set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0")

Only do it for debug though, so something like this:

if (CMAKE_BUILD_TYPE STREQUAL "Debug")
    if(WINDOWS)
        if(MSVC)
            set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Od")
        endif()
    elseif(ANDROID)
        set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0")
    endif()
endif()

@R101
Still the same issue. I think Android Studio doesn’t let you set breakpoints anyway if it got optimized away.

The issue also exists on a fresh 3.17.1 project.
Are there any official recommended SDK Tool versions for build tools, ndk etc?
Maybe there is still an issue with the Symbols… i’m kinda running out of ideas.

Have you tried building the cpp-tests project for Android, to see if it has the same issues?

I’ll try get an Android build done for my own app over the next day or so to see if I come across the issue.

I have not but I think I’ve found the issue. It seems to be my device itself.
Luckily I had a really old API 15 device and simply tried on there and now it works, so the issue must be an software update on my main device since I’ve checked the debug settings multiple times already, which is kinda annoying

@Sleicreider That’s good to know!

So the device is an Huaweii Mate 10 Lite, maybe it’s just an Huaweii issue?
https://developer.huawei.com/ict/forum/thread-50127.html (have to translate it)

I could simply get a new device which is kinda annoying.

@Sleicreider I just tested it, and came across no issues with the Huawei Nexus 6P, with Android 8.1.0. I could put debug breakpoints on any line, and they all worked.

You may be right though, in that it may be only a few devices that have this specific problem.

It is strange yeah, for now I probably just get a new test device, since this issue already consumed so much time. I remember having this issue multiple times already(only on this phone), probably after software updates.

Debugging also works on the Huawei P smart, so this issue exists only on some Huawei devices with certain updates I guess.