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.
Related
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.
Android Studio can't start the debugger if I use C code though JNI.
Running it normally works well, but the debugger doesn't even start, regardless if I'm debugging Kotlin or C code.
It throws a message Debugger process finished with exit code 127. Rerun 'app'
And the only detail it gave me is com.intellij.execution.ExecutionFinishedException: Execution finished.
Here I set up a simple github repository to replicate the error: https://github.com/perojas3/Android-JNI-debug-bug-example. It simply calls C code to get a string and then displays it in a toast.
And here I set up an small youtube video displaying the bug the way it is happening: https://youtu.be/8jIL5yqP7m8
I'm using Manjaro Linux right now.
I had the same issue and installing libncurses5 package solved it.
If using Ubuntu: sudo apt install libncurses5 and launch the debugger again (no android studio restart required).
I also had this issue.
I was able to run and debug my code normally, but for some reason I started to get this crash while running on debugging mode:
Debugger process finished with exit code 127
After playing a lot with Android Studio's settings and Edit Configurations, clearing caches, restarting both Android Studio and the computer and many other things, nothing was helpful.
I struggled with it a lot and the fact that there're no discussions anywhere about it annoyed me a lot, so having no information online together with the previous feeling about it happening after upgrading to Android Studio 4.2, made me think maybe it's a new issue raised in Android Studio's new 4.2 version.
So, I decided to download Android Studio 4.1.3 and give it a try. It worked like a magic and I can finally debug my code :)
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.
When I worked with Eclipse, I used Debug.waitForDebugger() to enter debug mode in hard to reach classes like services.
However, since I moved to Android Studio, I was not able to get Debug.waitForDebugger() to work.
When I add it and run the app, it does not enter debug mode at all.
Does anyone know how to make Debug.waitForDebugger() work in Android Studio?
Quoting from AOSP issue 76040 https://code.google.com/p/android/issues/detail?id=76040 -
"DDMS in Eclipse will monitor apps run on a device. When apps show up in ddms in "waiting-for-debugger" mode and the app name (its package) match the package of an app opened in the workspace, then ADT will automatically connect the debugger configured with that particular app.
We should do this in Studio as well. Probably after 1.0 though"
Up until today this problem has not been resolve yet in Android Studio.
try android.os.Debug.waitForDebugger();
Use the emulator/device entries under "Settings>Development Options" as advised here
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.