How can I enter an LLDB command via Android studio?
According to here:
In addition to the normal Android Studio UI, the debugger window has an LLDB tab that lets you enter LLDB commands during debugging. You can enter the same commands that Android Studio uses to display information in the debugger UI, and you can perform additional operations.
Great! ... But where is the "LLDB tab"? There is indeed a "Console" tab in the Debug tab which says:
Connected to the target VM, address: 'localhost:8600', transport: 'socket'
But text typed here followed by an enter does nothing, paused or not paused.
LLDB tab was missing because I had "android-gradle-native-java" selected instead of "android-gradle-native".
Related
I am developing an Android app with Xamarin on Visual Studio 2019, on Windows. I could successfully deploy the app to an old Android phone, but when I tried to deploy to a relatively new Acer Chromebook, I hit a snag. The connection from Windows to Chromebook was established, the command
adb devices
lists the Chromebook, and Visual Studio also shows it on the Run toolbar. But when I click the Run button, I get the message "There were deployment errors" and the following error appears in the error list window:
The 'run-as' tool has been disabled on this device. Either enable it by activating the developer options on the device or by setting ro.boot.disable_runas to false.
On my Chromebook, Linux was installed, Developer Options are On and ADB Debugging is also On.
Curiously, after this failed deployment, the app appears on the Chromebook's Apps list as "AndroidApp1". But it won't run, I just see a blank screen.
So how do I set this mysterious ro.boot.disable_runas property to false on my Chromebook? Thank you in advance.
Disabling "Fast deployment" under Android Options fixes this error and the app deploys. I'd still like to know how to set the ro.boot.disable_runas property to false.
It's a device property which is visible in adb, but devices can disable it from being changed. My Lenovo refuses to set it.
Try opening a "Linux terminal" in the developer mode apps, then...
$ adb shell
$ getprop ro.boot.disable_runas
1
$ setprop ro.boot.disable_runas 0
setprop: failed to set property 'ro.boot.disable_runas' to '0'
$
Perhaps it will work on yours. I just unchecked the Fast Deploy option in the Xamarin Android project debug properties.
Recently upgraded to Android Studio 4.2.1
I can launch my app successfully but when I try to attach the debugger I get the error in the question title (see screenshot below).
The app just gets stuck on the "Waiting For Debugger" screen.
Everything worked as expected prior to upgrade.
This is the output from the debug log
$ adb shell am start -n "com.*.*/com.*.*.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -D
Waiting for application to come online: com.*.* | com.*.*.test
Waiting for application to come online: com.*.* | com.*.*.test
Connected to process 9869 on device 'amazon-kfmuwi-G0W0X8089256FRU1'.
Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page.
W/ActivityThread: Application com.*.* is waiting for the debugger on port 8100...
I/System.out: Sending WAIT chunk
Connecting to com.*.*
Now Launching Native Debug Session
com.intellij.execution.ExecutionFinishedException: Execution finished
Process finished with exit code 0
In logcat I also see
2021-05-19 12:55:32.855 10394-10394/? E/azon.kindle.cm: Not starting debugger since process cannot load the jdwp agent.
I have tried:
Restarting Android device
Restarting development device
Invalidating and Restarting Android Studio
Reinstalling Android Studio
My system is running Pop!_OS 20.10
Debug error
I've solved that by installing 'libncurses5' and 'ia32-libs' packages
This is a known issue and is provided on the android developer's official page. Here is the link https://developer.android.com/studio/known-issues?hl=de#native_debugger_crashes_with_debugger_process_finished_with_exit_code_127
It turns out it's a Linux-specific issue and is because Linux uses upgraded 'libncurses6' and android studio uses 'libncurses5' required to run the debugger.
I've solved this by installing 'libncurses5' only
sudo apt install libncurses5
Thanks to Max Elkin
I eventually solved this by rolling back to Android Studio 4.1.
I rolled back AS from 4.2 to 4.1.3 which solved the error
In case the accepted answer doesn't help, here's how to find the root cause:
Search for the Debug log settings action (via CTRL + SHIFT + A)
Set #com.jetbrains.cidr.execution.debugger:trace in the dialog (source)
Try run or attach the debbuger
Search for the Collect Logs and Diagnostic Data action (via CTRL + SHIFT + A)
Inspect the idea.log file inside the zip. It should show why the debugger fails.
For example, I saw this error brains.cidr.execution.debugger - LLDBFrontend: Fatal Python error: config_get_locale_encoding: failed to get the locale encoding: nl_langinfo(CODESET) failed
Which was fixed by setting this in ~/.zshrc (source)
export LC_ALL="en_US.UTF-8"
export LC_CTYPE="en_US.UTF-8"
I'm following some tutorials about building apps in Android Studio, but for some reason it's not launching/installing the latest version of my app when I click 'run'. I have to manually uninstall the app on the phone and then click run after making changes in Android Studio for the app to get updated. Any ideas?
Here is the console output:
Waiting for device.
Target device: htc-htc_one_m8
Uploading file
local path: /home/brandon/AndroidStudioProjects/JustJava/app/build/outputs/apk/app-debug.apk
remote path: /data/local/tmp/com.example.android.justjava
No apk changes detected. Skipping file upload, force stopping package instead.
DEVICE SHELL COMMAND: am force-stop com.example.android.justjava
Launching application: com.example.android.justjava/com.example.android.justjava.MainActivity.
DEVICE SHELL COMMAND: am start -D -n "com.example.android.justjava/com.example.android.justjava.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.android.justjava/.MainActivity }
Waiting for process: com.example.android.justjava
Connected to the target VM, address: 'localhost:8638', transport: 'socket'
Disconnected from the target VM, address: 'localhost:8638', transport: 'socket'
No apk changes detected. Skipping file upload, force stopping package instead.
Android Studio thinks that there are no changes and doesn't install the new APK. A workaround is to disable the "Skip installation if APK has not changed" option in Run > Edit Configurations.
I'm using Android Studio 1.4
Source: https://code.google.com/p/android/issues/detail?id=160901
Android Studio thinks that there are no changes and doesn't install the new APK. A workaround is to disable the "Skip installation if APK has not changed" option in Run > Edit Configurations >Android Application > app >Miscellaneous .
Then uncheck "Skip installation if APK has not changed".
Another problem like this is instant Run you can manage it by :- Just go to "File -> Settings -> Build, Execution, Deployement -> Instant Run" and just disable it. With this Android Studio builds from scratch each time but it's better than not building it right.
This is actually a bug
you can find more info Android Open Source Project - Issue Tracker
Disabling instant run option in edit configuration and adding -r flag to the install flags is best work around for now.!
option in Run > Edit Configurations >Android Application > app >Miscellaneous . Then uncheck "Skip installation if APK has not changed".
THEN --> option in Build > clean project and rebuild project
and reinstall APK in your device.
THIS WORKS FINE FOR ME, HOPE THIS HELP OTHER ALSO
Another reason why the app might fail to install/start is if you've set up a "work profile".
The app might still be installed in your "work" profile and thus won't be re-installed nor uninstalled when starting through Android Studio. The "main"-profile portion of the app is "disabled" though and thus the activity can't be started.
Solution: manually uninstall the work-app, then redeploy from Android Studio.
Sometimes when I get this I just kill the app on the device, then run it. Throw in a log statement to clarify you're on the right build, just something that you know you changed for this build.
I have tried all of above solution but didn't work for me.
I solved by Opening a new project or some other existing project (being in current project) in a new window and then I closed the previous one..
I opened again the previous one and clicked on run and it worked for me like a charm..:)
Run on a Phone
Set up your device as follows:
Connect your device to your development machine with a USB cable. If you're developing on Windows, you might need to install the appropriate USB driver for your device. For help installing drivers, see the OEM USB Drivers document.
Enable USB debugging on your device by going to Settings > Developer options.
Note: On Android 4.2 and newer, Developer options is hidden by default. To make it available, go to Settings > About phone and tap Build number seven times. Return to the previous screen to find Developer options.
Run the app from Android Studio as follows:
In Android Studio, click the app module in the Project window and then select Run > Run (or click Run in the toolbar).
In the Select Deployment Target window, select your device, and click OK.
Please refer the link
I use Qt Creator to develop an Android dynamic library, i.e. a .so file. This .so file is then used by an Android application, but that is developed in Eclipse.
I need to debug my native code, but since it's a library, I can't start the application from Qt Creator, I must attach to the already running process.
Now, if it were a desktop application, I'd use Debug->Start Debugging->Attach to Running Application, but how do I attach to an Android process, which would be running on the emulator or on a connected phone, which is more like remote-debugging?
I think that I should use Debug->Start Debugging->Attach to Running Debug Server:
However, I'm not sure what the exact steps are - how do I start a debug server for ADB, and which port do I connect to?
So it looks like there may be another way to set up a debugger that can connect properly.
http://lists.qt-project.org/pipermail/qt-creator/2012-June/001017.html
Set a toolchain with this version of gdb, and set your project to use it.
In Tools -> Options -> Debugger -> GDB insert your commands in "Additional
Startup Commands"
...
I use Debug -> Start Debugging -> Attach to Remote. All the fields are
there (solib-absolute-prefix is an alias for sysroot, and "location of
debugging information" is solib-search-path), and the last few
"configurations" are stored, so you can call them back easily. I have
to start gdbserver on the target manually, set a shortcut to open the
'attach to remote' dialog, and it is been working great for me so for.
It's old (June 2012), but it goes into better detail about how the gdbserver is started and the setup for a debugger and attaching to a process in Qt. It also mentions some of the relevant environment variables:
set solib-absolute-prefix $ANDROID_SRC/out/target/product/MYPRODUCT/symbols/
set solib-search-path $ANDROID_SRC/out/target/product/MYPRODUCT/symbols/system/lib/
Hope that helps.
Attaching to a adb logcat is independent of Qt and what Android source you are using. Make sure adb.exe can be found on your path such as: C:\Android\SDK\platform-tools, and you have the adb drivers for the device you are debugging with. Try this one if you are struggling: http://www.koushikdutta.com/post/universal-adb-driver
Command Line ADB commands
This should print out any connected devices that can be found:
adb devices
This clears the current logcat logs:
adb logcat -c
This starts a connection to logcat:
adb logcat
Usually you don't have to worry about which port to connect to, because it is automatically found by adb.
Attaching to logcat over wifi is also do-able.
adb tcpip
adb connect 192.168.XX.XX:5555
Hope that helps.
Every time I try to debug any project with Android Studio, the app does not start, and immediately the console gives following message:
Connected to the target VM, address: 'localhost:8603', transport: 'socket'
Test running startedDisconnected from the target VM, address: 'localhost:8603', transport: 'socket'
I generally try to debug on my HTC Desire Z with Android 2.3.3 device and I remember that with Eclipse IDE the "debugging" works without any issues.
I finally solved it!
The problem was that at the left of start and debug button, the configuration menu was set to test. Just put it on App and now it works.