Android Studio debugger taking too long to start/load - android

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.

Related

Android Studio Windows: Debugger process finished with exit code -1073741515 (0xC0000135)

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.

How do I get Visual Studio to debug an Android app?

I'm using Visual Studio 2017 to build and deploy a NativeActivity to my Android device. It builds and deploys with no issues, but I cannot set breakpoints.
Before running, I can add a breakpoint to a line (the first line of android_main() for example) and the little red circle shows up on the left of that line in the IDE as you'd expect.
But after installing and running the app, the breakpoint doesn't trigger because the red circle has turned white - it's saying there are no debug symbols.
I've verified I'm building the Debug version and have verified the APK file is bigger and has the debug symbols by using Android Studio.
At this point it appears to me that Visual Studio itself is confused and somehow doesn't recognize the debug symbols.
I've added "-g" to the C++ options manually, and have added the Gradle line packagingOptions.doNotStrip '**.so' as well. But still this problem persists.
What would cause this behavior in Visual Studio and how can I fix it?
The Xamarin debugger can only debug managed (i.e. C#) code. Breakpoints only work with the Xamarin debugger if the project being debugged is a managed project. They don't work if the project is a native app or native library.
So you have to make NativeActivity c++ app be attached to a Xamarin Managed App(Acttach to Process)to get what you want.
1) create a c# xamarin android app and then input that xamarin managed apk file into the NativeActivity c++ app's Properties-->Debugging-->Package To Launch
2) start Xamarin c# app first and then make the Xamarin debugger active. While the managed app is still running or being debugged, right-click on the native library project and select Debug --> Attach to Android process.
Here is an example provided by Richard Walters and he provided the detailed info.

How to disable android native debugger in Android studio

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.

Error in final launch sequence Failed to execute MI command -gdb-set target-async off

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

Scala+Android: Is anybody successfully building and debugging in Eclipse?

So far, the only way I've been able to debug within Eclipse is to use Treeshaker with Scala IDE's buggy 2.8 branch. If I try to build with Scala IDE without Treeshaker, I get ClassNotFound errors per this long thread on scala-on-android.
Ideally I would build with sbt-android and debug within Eclipse, but I've been unable to do so successfully. The closest to debugging an sbt-android project I was able to achieve was to build the sbt-android project with the android:package-debug command, start the executable with the android:start-emulator command, and then connect DDMS to the application's thread.
However, I had breakpoints set that only would have executed after I connected the debugger to the thread, and none of them caused the thread to stop when reached.
Has anyone been able to debug Scala Android code in Eclipse using any other tools besides Treeshaker with Scala IDE based on Scala 2.8?
UPDATE: I'm successfully debugging (not building) in Eclipse after building from the command line with sbt, sbteclipse, and android-plugin.
What I did was to use Eclipse's new Android project menu, connect to existing source, and point it to the ./src/main directory. Then Eclipse recognized the Android settings, and DDMS recognized the task as belonging to the Eclipse Android project.
I also had to reconfigure the Eclipse project's Java build path source folders by removing the src folder from the build path and adding the ./scala folder. Then I had to restart Eclipse to add breakpoints to the Scala file.
Here's some interesting discussion about the difficulties building and debugging Android applications using Eclipse.
In general debugging Scala code running on Android using Eclipse works well and behaves more or less like debugging Scala on regular (non-Android) applications.
I use sbt with sbt-android and android:start-emulator or android:start-device.
Depending on whether I need to debug the application startup, I set the option to wait for the debugger in the developer settings on the device or emulator. To do this, run "DevTools" / "Development Settings". Select your application and check "Wait for Debugger".
Then you have to select the process to debug in DDMS. Make sure the debug port is shown, and then connect with the Eclipse debugger.
A potential cause for the debugger not installing the breakpoints is that the source code line has no direct equivalent in byte code. For comprehensions come to mind.
Using AndroidProguardScala, I am successful in debugging, using scala 2.10 and Eclipse 3.7
It also deals with for comprehensions as the usual plugin.
See the detailed answer there:
Eclipse, Android, Scala made easy but still does not work
The only missing feature is the new scala debugger in the latest scala eclipse plugin, which is not yet integrated. So for example, to debug a map, you will have to go though files such as Map.scala, ArrayBuffer.scala, Object.scala, and so on.

Categories

Resources