I have both native code and Java in my app so I need to be able to debug both Java and native code.
After upgrading to Android Studio Bumblebee | 2021.1.1 Patch 2, I can no longer debug my app with native debugging enabled. If the 'Debug type:' is set to Java Only, I can run in debug mode and trace through Java code but cannot trace into native functions. If 'Debug type:' is set to Detect Automatically, Native Only or Dual (Java+Native) the debugger fails to start.
I never had trouble debugging native code before. When I try to start in debug mode I get the following error:
Debugger process finished with exit code -1073741515 (0xC0000135). A library required by the native debugger might be missing on your system.
How do I find out what library is missing? I upgraded everything that Android Studio said had updates.
Go to "Run->Edit Configurations" then select the "Debugger" menu item and check to see if "Debug type" was set to "Detect Automatically". If so, try setting it to "Java Only", apply that and see if the debugger now works. That's what fixed it for me.
Related
I started testing AGDK and went through their Quickstart guide https://developer.android.com/games/agde/quickstart
I also read myself through the Debugger section.
Starting the Sample project "teapot" was no problem on my USB connected phone, but I couldn't debug properly. My breakpoints won't get hit.
I tried to Attach to the running teapot app session of my phone like described in the Debugger Guide and my breakpoints got hit properly.
Why isn't it working when I just start the Debugger on my Phone? Visual Studio also says "Attach to Process.." while my Phone is waiting for the Debugger to attach and after a few seconds the app starts.
Make sure that you have set the target project as startup project(right-click the project > Set as Startup Project), and have chosen Debug configuration in VS IDE. Also make sure you have done what this document: Enable Debugging on the Device mentioned and try to rebuild the project.
In addition, please try to set project properties > Build > Advanced Build Settings > Output > Debugging information to Portable.
Using Studio 2.3, gradle:2.2.1
When I try to attached debugger to app, it shows Android Hybrid Debugger ->
Now Launching Native Debug Session Attention! No symbol directories
found - please check your native debug
Start hybrid debugger.
And loading all *.so libraries.
I try to rename Android sdk/lldb to lldb_bak but still starting hybrid debugger.
It takes too long, waste of time. Mean while app is not responding. Can any one help me to disable native debugging. I need only java debugging.
Edit:
After uninstalling LLDB from sdk tools Android Studio ask me for Quick fix dialog saying "C++ debugger is missing". If I press yes. It install LLDB again and if I press no it gives me error saying.
Error running Android Hybrid Debugger (23533): C++ debugger package is
missing or incompatible
By the way I am using wireless debugging and I have c++ module with sources in my project.
Changing run configuration -> "Debug type" to 'Java' doesn't work for me.
I found solution. Select Java from debugger list. Enjoy. Sometime it happens :)
For the ones still looking for a permanent solution:
Go to menu Run, then Edit Configurations. Under Debugger then select the Debug Type Java.
I had recently intalled NDK and had worked on jni for some time. I am again now shifted to my normal Android work but now when I am applying a debugger, the debugger is taking too much time to load. It loads many so files and all which are required to debug native code/ jni related stuff. I want to disable this so that debugger knows that I do not wnt to debug any cpp files. I am using Android studio 2.2.2 and I have tried setting "Debug type" of debugger to "Java" from "Edit Configurations" but it did not helped me. It stills loads the LLDB server and related so files while stating debugger.
Any help would be really appreciated.. !!!
run app first, then press the "attach debugger to android process" button, it will open a choose process dialog, set the debugger from 'auto' to 'java'.
Its probably because you have introduced C++ native libraries in your App, to only debug java, click Run > Edit Configurations and then in the debugger tab, change Debug Type to Java
According to docs:
Because different debugger tools are required to debug Java/Kotlin
code and C/C++ code, the Android Studio debugger allows you to select
which debugger type to use. By default, Android Studio decides which
debugger to use based on which languages it detects in your project
(with the Auto debugger type)
The debug types available include the following:
Auto
automatically choose the best option for the code you are debugging.
For example, if you have any C or C++ code in your project, Android
Studio automatically uses the Dual debug type. Otherwise, Android
Studio uses the Java debug type.
Java
Select this debug type if you
want to debug only code written in Java or Kotlin—the Java debugger
ignores any breakpoints or watches you set in your native code.
Native (available only with C/C++ code)
Select this debug type if you want to
use only LLDB to debug your code. When using this debug type, the Java
debugger session view is not available. By default, LLDB inspects only
your native code and ignores breakpoints in your Java code. If you
want to also debug your Java code, you should switch to either the
Auto or Dual debug type.Select this debug type if you want Android Studio to
1). Go to the debugger and select view breakpoints
2).Make sure the All Breakpoint is unchecked.
I have Android Studio 1.3.2, NDK r10e, gradle experimental plugin 0.2.0. I have cloned the ndk samples repo and carefully followed instructions for the NDK Preview, including creating a Native configuration.
When I select LLDB as the debugger and debug the Teapot NDK sample app (breakpoint in TeapotNativeActivity.cpp, line 393), the app runs, but breakpoint isn't hit as it should when I rotate the teapot. Using GDB for the debugger results in the app freezing on startup. I then have to force quit the app and press stop in the debugger window.
In both cases, debug controls appear (greyed out), and the variables window says, "Connecting", but I never see the "Waiting for Debugger" dialog on my device.
Console output using LLDB:
Console output using GDB:
Now, when I do the same thing from Android Studio 1.4 Preview 3, I now get the "Waiting for Debugger" dialog, but it hangs there. It looks like the debugger never connects.
Console output Android Studio 1.4:
Is it possible to debug with AS 1.3.2 or 1.4? What do I need to do next to get it working?
I upgraded to Android Studio 1.4 beta and the issue is fixed. I can now debug my C++ code.
I have two projects on eclipse, one produces an so and the other is Android application which uses it I am trying to debug the native code in the so using this guide.
I set my application debuggable
I started my application in the debug mode
I run ndk-gdb
When I run the native debugger I am getting:
Error in final launch sequence
Failed to execute MI command:
-gdb-set target-async off
Error message from debugger back end:
Cannot change this setting while the inferior is running.
Cannot change this setting while the inferior is running.
I found this link here link and actual author is marc.
Since you followed the guide and have installed CDT.
When CDT launches, it tries to set a breakpoint at main, so it will interrupt execution when your program starts. However, your target is already running so the breakpoint cannot be set and the whole things fails.
You could simply tell your launch not to set that breakpoint and let it connect to your target.
Go to: Run->Debug Configurations... and find your launch configuration. Then select the Startup subtab, scroll down and uncheck "Set breakpoint at" in the "Runtime options" subsection.
****It may be also related to OS you are using since this is an issue with inferior execution.**** and thus a patch may be needed.But before doing anything try above.It may solve your issue.
Also removing the "target" command from the .gdbinit file may help as the eclipse plugin already issues this command.
If nothing works you may look for changing debugger because at last its a gdb compilation problem.
My answer is purely based on r&d.
There is a mismatch between the gdb client inside eclipse and the gdb server. Try changing the gdb client in eclipse
debug settings --> Debugger --> Main Tab --> Browse to gdb compiled
for the same platform