Debugging of my app is now suddenly broken. It has been fine up to now and I even reloaded a known good version of my entire code and it still fails to debug or even run. When I hit debug or run the app starts up and right when it is about to display the app, it crashes (before even entering the main view). I have a break point on the first line of code and it never even reaches it. It just goes to Source not found - The source attachment does not contains the source for the file DexFile.class.....
I am 100% certain all the code I have loaded is working, as it is a saved backup which was saved when last working.
Also, what is odd is that if I unplug the cable at this point, the app loads normally and works fine. So this is definitely a debugging issue. It is getting stuck somewhere at boot. I have restarted my computer and phone several times to no avail.
LogCat:
`04-04 11:17:33.462: DEBUG/AndroidRuntime(4148): CheckJNI is OFF
04-04 11:17:33.462: DEBUG/dalvikvm(4148): creating instr width table
04-04 11:17:33.502: DEBUG/AndroidRuntime(4148): --- registering native functions ---
04-04 11:17:33.712: DEBUG/AndroidRuntime(4148): Shutting down VM
04-04 11:17:33.712: DEBUG/dalvikvm(4148): Debugger has detached; object registry had 1 entries
04-04 11:17:33.712: INFO/AndroidRuntime(4148): NOTE: attach of thread 'Binder Thread #3' failed
04-04 11:17:33.902: DEBUG/AndroidRuntime(4157): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
04-04 11:17:33.902: DEBUG/AndroidRuntime(4157): CheckJNI is OFF
04-04 11:17:33.902: DEBUG/dalvikvm(4157): creating instr width table
04-04 11:17:33.942: DEBUG/AndroidRuntime(4157): --- registering native functions ---
04-04 11:17:34.152: INFO/Process(107): Sending signal. PID: 4137 SIG: 9
04-04 11:17:34.152: INFO/ActivityManager(107): Force stopping package org.scanner uid=10110
04-04 11:17:34.162: ERROR/ActivityManager(107): fail to set top app changed!
04-04 11:17:34.182: INFO/UsageStats(107): Unexpected resume of com.htc.launcher while already resumed in org.scanner
04-04 11:17:34.192: INFO/ActivityManager(107): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=org.obdscanner/.activity.ObdReaderMainActivity }
04-04 11:17:34.202: DEBUG/AndroidRuntime(4157): Shutting down VM
04-04 11:17:34.202: DEBUG/dalvikvm(4157): Debugger has detached; object registry had 1 entries
04-04 11:17:34.212: INFO/AndroidRuntime(4157): NOTE: attach of thread 'Binder Thread #3' failed
04-04 11:17:34.222: WARN/InputManagerService(107): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy#464105d8
04-04 11:17:34.242: INFO/ActivityManager(107): Start proc org.scanner for activity org.obdscanner/.activity.ReaderMainActivity: pid=4165 uid=10110 gids={3003, 3002}
04-04 11:17:34.332: WARN/ActivityThread(4165): Application org.scanner is waiting for the debugger on port 8100...
04-04 11:17:34.332: INFO/System.out(4165): Sending WAIT chunk
04-04 11:17:34.352: INFO/dalvikvm(4165): Debugger is active
04-04 11:17:34.472: DEBUG/Norton Community Watch/smrsd(3910): smrsd broadcast intent success!
04-04 11:17:34.512: ERROR/(3910): /data/data/com.symantec.monitor/app_log_item/1301930254.txt//data/data/com.symantec.monitor/app_log_item
04-04 11:17:34.542: INFO/System.out(4165): Debugger has connected
04-04 11:17:34.542: INFO/System.out(4165): waiting for debugger to settle...
04-04 11:17:34.632: INFO/global(3898): Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char buffer is required.
04-04 11:17:34.742: INFO/System.out(4165): waiting for debugger to settle...
04-04 11:17:34.862: DEBUG/dalvikvm(3898): GC_FOR_MALLOC freed 4492 objects / 274560 bytes in 41ms
04-04 11:17:34.942: INFO/System.out(4165): waiting for debugger to settle...
04-04 11:17:35.142: INFO/System.out(4165): waiting for debugger to settle...
04-04 11:17:35.342: INFO/System.out(4165): waiting for debugger to settle...
04-04 11:17:35.552: INFO/System.out(4165): waiting for debugger to settle...
04-04 11:17:35.752: INFO/System.out(4165): waiting for debugger to settle...
04-04 11:17:35.952: INFO/System.out(4165): waiting for debugger to settle...
04-04 11:17:36.157: INFO/System.out(4165): debugger has settled (1451)
04-04 11:17:37.296: DEBUG/dalvikvm(4165): threadid=1: still suspended after undo (sc=1 dc=1 s=Y)
`
Please see the correct annswer HERE
You have set a break point in one of the classes. Just take off all the break points in your project and run again, their will be no problem.
Eclipse->Window->Show View->(Other->Debug->)Breakpoints
Occasionally Eclipse and the various Android development plug-ins will become out of sync. I usually attempt the following when debugging / development gets "funky"
If your Logcat is not displaying lines, clear it. It has a small buffer. Also ensure that your device is selected in the "DDMS" perspective. If you have the emulator selected you will only receive logging from it.
Clean and Rebuild all open projects. Ensure there are no errors.
Uninstall the application from the remote device/emulator.
Restart Eclipse!
Open a terminal on your platform and use the tool adb in the "platform-tools" directory.
adb kill-server
adb start-server
Stash your working copy and revert your source code if using a repository.
Strange solution...I just closed the project from package explorer, then removed it from the workspace. Closed Eclipse. Re-opened Eclipse and imported the project.
(Copy and pasted from Jesse's comment.)
I tried all of the above, but i turned out that it was not working due to multiple instances of eclipse.exe
Killing them all in the task manager (CTRL+SHIFT+ESC) solved it.
On your Android device (or emulator) go to:
Applications - Settings - Applications - Manage applications - All
There you have to select your app and uninstall it.
Afterwards try to run your app from the IDE again. It should work now.
Create a new debug configuration of type Remote Java Application and set it to localhost and the port you see on the DDMS window.
https://stackoverflow.com/a/13421917/624109
I know this is kind of late.... use it if #Sam's or #Killesk's answers do not work.
ensure the manifest sets android:debuggable.
In onCreate, add a call to Debug.waitForDebugger.
Adding the call to waitForDebugger also works when reversing. For example you can add the following by hand in onCreate and have smali/baksmali recompile it:
invoke-static {}, Landroid/os/Debug;->waitForDebugger()V
I don't have to use the tricks often, but when I do, waitForDebugger always works. I don't recall a time I could not snap the debugger with it.
I've had this happen due to my code being obfuscated. I didn't notice that someone had changed proguard.cfg for a production release and commented-out the "-dontobfuscate" line.
Related
I'm trying to debug NDK application on my Nokia 7.1 from Android Studio (3.4.1) but I'm getting this error:
Error running 'app': Unable to open debugger port (localhost:8600): java.io.IOException
I can connect to device with ndk, run app without debugging and even debug application using Java debugger (Run/Debug configurations -> Debugger -> Debug type: Java). Also debugging application C code is working on another phone (CAT S60).
First I was thinking about debugger connection timeout, so I increased it to 500000ms. This didn't help.
Attaching to running process is working but only Java or only Native debugger. Dual debugger failed to connect Java part and application is waiting for debugger.
Here is message from debugger console:
Debugger attached to process 29042
Timed out waiting for java debugger to attach
Process finished with exit code 0
Does anybody have experience how to run dual debugger on Nokia 7.1?
So I just updated to Android Studio 2.2 and I'm having problems running my app on my device. What seems to happen is that now there are two separate debuggers running when I try to debug my app. One of them is the good old Java debugger and the other one is I think the LLDB debugger.
My app has a splash screen which is presented as the first Activity in the app. What happened before was the splash screen would only be shown around 1 second before the actual intro screen showed up. After I updated my Android Studio to version 2.2, it takes around a minute before the splash screen disappears.
I put a breakpoint to the SplashScreenActivity.onCreate() to see if everything was OK. After I launch the app, it waits for some time before the LLDB debugger stops with a SIGURG signal. I click resume program and again it hits the same signal. This happens 7-8 times, after which my breakpoint in SplashScreenActivity.onCreate() is hit by the Java debugger. After this, the app keeps working normal.
I don't know if it helps but the console of the LLDB debugger is like this:
09/26 00:19:32: Launching app
No apk changes detected since last installation, skipping installation of D:\Documents\SourceTree\autocolorsplash-android\app\build\outputs\apk\app-debug.apk
$ adb shell am force-stop com.kayimapps.autocolorsplash_android
$ adb shell am start -n "com.kayimapps.autocolorsplash_android/com.kayimapps.autocolorsplash_android.activities.SplashScreenActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -D
Waiting for application to come online: com.kayimapps.autocolorsplash_android | com.kayimapps.autocolorsplash_android.test
Waiting for application to come online: com.kayimapps.autocolorsplash_android | com.kayimapps.autocolorsplash_android.test
Connecting to com.kayimapps.autocolorsplash_android
Now Launching Native Debug Session
Starting LLDB server: /data/data/com.kayimapps.autocolorsplash_android/lldb/bin/start_lldb_server.sh /data/data/com.kayimapps.autocolorsplash_android/lldb unix-abstract /data/data/com.kayimapps.autocolorsplash_android/lldb/tmp platform-1474838375380.sock "lldb process:gdb-remote packets"
Debugger attached to process 927
Signal: SIGURG (signal SIGURG)
Signal: SIGURG (signal SIGURG)
Signal: SIGURG (signal SIGURG)
Signal: SIGURG (signal SIGURG)
Signal: SIGURG (signal SIGURG)
Signal: SIGURG (signal SIGURG)
Signal: SIGURG (signal SIGURG)
Signal: SIGURG (signal SIGURG)
I'm not using any C++ in my app other than some compiled OpenCV code, which I haven't touched at all. I'm only using the Java wrapper for OpenCV.
The debugger frame looks like this after the first SIGURG signal:
I don't know if there's any other relevant information I can give about the situation since I have no idea what's going on. Please do tell me if this seems like something you have seen before and requires some additional info.
So I couldn't find why LLDB made me wait for around a minute but I found where to disable LLDB altogether. I don't know if it was there prior to Android Studio 2.2, but you can go to Run->Edit Configurations and from the Debugger pane you can set Debug Type to Java instead of Auto.
This disables LLDB and turns things back to how they were before 2.2. However launching the app for the first time through adb still causes the splash screen to stick around for some time.
I have an ADK Kit from Google I/O 2011 and I am trying to get the example application to work (Available here: http://developer.android.com/tools/adk/adk.html).
I have programmed the firmware and device as instructed, but cannot get the demo to work. The application starts, and detects the ADK board when plugged in, but then enters a loop in which the device connects then disconnects very rapidly, causing the UI Activity to keep restarting.
I have been debugging this for a few days, and have verified that the device gets an IOException in the run() method of DemoKitActivity.java which causes the thread to terminate, although I am unsure if this is caused by or the cause of the device disconnecting.
The exception thrown is:
06-27 23:21:51.284: E/DemoKit(13573): There was an IO Exception
06-27 23:21:51.284: E/DemoKit(13573): at libcore.io.IoBridge.read(IoBridge.java:435)
06-27 23:21:51.284: E/DemoKit(13573): at java.io.FileInputStream.read(FileInputStream.java:179)
06-27 23:21:51.284: E/DemoKit(13573): at java.io.InputStream.read(InputStream.java:163)
06-27 23:21:51.284: E/DemoKit(13573): at com.google.android.DemoKit.DemoKitActivity.run(DemoKitActivity.java:278)
06-27 23:21:51.284: E/DemoKit(13573): at java.lang.Thread.run(Thread.java:841)
06-27 23:21:51.284: E/DemoKit(13573): Caused by: libcore.io.ErrnoException: read failed: EIO (I/O error)
06-27 23:21:51.284: E/DemoKit(13573): at libcore.io.Posix.readBytes(Native Method)
06-27 23:21:51.284: E/DemoKit(13573): at libcore.io.Posix.read(Posix.java:127)
06-27 23:21:51.284: E/DemoKit(13573): at libcore.io.BlockGuardOs.read(BlockGuardOs.java:149)
06-27 23:21:51.284: E/DemoKit(13573): at libcore.io.IoBridge.read(IoBridge.java:425)
One possible quirk is that my device is set to communicate over PTP (Settings > Storage > Menu > USB Computer Connection > Camera (PTP).
I don't yet have much more information. I am hoping that someone can confirm that the example code provided by Google still works with the ADK, or can provide some insight into where to look next to debug the disconnections.
I can confirm that the example ADK code works with both a Nexus 4 running 4.2.1 and a Galaxy Nexus running 4.0.4.
I've tried both using the Gingerbread compatibility API and using the API 12 classes on the Android DemoKit app successfully.
The ADK 2011 board that I have hasn't been used recently so while it worked with a ICS (4.0.4) device it wasn't working with the Nexus 4 with JB.
The following SO topic covers the issue with JB:
ADK 1.0 devices fail to work with Jelly Bean, why?
Also the CapSense libraries have been renamed in the most recent download from the Arduino site. CapSense.h becomes CapacitorSensor.h and so on.
Otherwise I was able to install the new code onto the Arduino ADK board, install the app on the Android device and run the DemoKit app.
The Nexus 4 was also in PTP mode during my test so I don't that that is your problem.
I'm also assuming you got your logs via adb over wi-fi and not connecting it over usb as that cable should go into the ADK board. Other than making sure the ADK code is correct and perhaps trying it with a different USB cable or PC I don't have anything to suggest. While I did see some errors in the log for one test session, a reset of the ADK and app cleared it up. For reference here is my logcat from a working session hope it can help.
07-06 23:01:02.364 I/ActivityManager( 575): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.google.android.DemoKit/.DemoKitLaunch} from pid 899
07-06 23:01:02.404 I/ActivityManager( 575): Start proc com.google.android.DemoKit for activity com.google.android.DemoKit/.DemoKitLaunch: pid=8715 uid=10110 gids={50110, 1028}
07-06 23:01:02.495 I/DemoKitLaunch( 8715): starting phone ui
07-06 23:01:02.925 D/DemoKit ( 8715): accessory opened
07-06 23:01:03.185 I/ActivityManager( 575): Displayed com.google.android.DemoKit/.DemoKitPhone: +692ms (total +795ms)
07-06 23:01:35.690 D/UsbDeviceManager( 575): entering USB accessory mode: UsbAccessory[mManufacturer=Google, Inc., mModel=DemoKit, mDescription=DemoKit Arduino Board, mVersion=1.0, mUri=http://www.android.com, mSerial=0000000012345678]
07-06 23:01:35.690 I/ActivityManager( 575): START u0 {flg=0x10000000 cmp=com.android.systemui/.usb.UsbConfirmActivity (has extras)} from pid 575
07-06 23:01:35.860 I/ActivityManager( 575): Displayed com.android.systemui/.usb.UsbConfirmActivity: +64ms
07-06 23:01:37.782 I/ActivityManager( 575): START u0 {act=android.hardware.usb.action.USB_ACCESSORY_ATTACHED flg=0x10000000 cmp=com.google.android.DemoKit/.UsbAccessoryActivity (has extras)} from pid 748
07-06 23:01:37.912 I/DemoKitLaunch( 8715): starting phone ui
07-06 23:01:37.912 I/ActivityManager( 575): START u0 {flg=0x14000000 cmp=com.google.android.DemoKit/.DemoKitPhone} from pid 8715
07-06 23:01:38.022 D/DemoKit ( 8715): accessory opened
I have an appWidget project I've been working on and noticed the Eclipse debugger does not seem to be working. I thought it might be borked, so I opened up another Android project and set a breakpoint and it worked fine. In my appWidget application however, the debugger will not work no matter where I set the breakpoint. I can set the breakpoint right on a Log statement, see the message print, but there is no interruption of execution.
I read something about having to install the 'Android sources' but it seems to me that if the debugger was missing something, it wouldn't work at all. The only clue I have is Logcat is printing "Debugger has detached" which offers little help. Other posts have suggested two Eclipse processes running (ps -ef shows only one), restarting adb (I've done adb kill-server; adb start-server) or that the process crashed, which Logcat does not show:
5486 AndroidRuntime D
5486 AndroidRuntime D >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
5486 AndroidRuntime I Heap size: -Xmx48m
5486 AndroidRuntime D CheckJNI is OFF
5486 dalvikvm D creating instr width table
5486 AndroidRuntime D Calling main entry com.android.commands.pm.Pm
5486 AndroidRuntime D Shutting down VM
5486 dalvikvm D GC_CONCURRENT freed 103K, 70% free 307K/1024K, external 0K/0K, paused 0ms+0ms
5486 dalvikvm D Debugger has detached; object registry had 1 entries
5486 AndroidRuntime I NOTE: attach of thread 'Binder Thread #1' failed
That's all Logcat says when I launch the application in debug mode. Any thoughts?
I get this series of messages about once every six or so seconds from my Android emulator's LogCat output. I haven't noticed a cause, and it doesn't always happen, but when it does, it doesn't stop until I kill the emulator. Here's the repeated message:
07-28 20:53:00.763: DEBUG/AndroidRuntime(2756): Shutting down VM
07-28 20:53:00.763: DEBUG/dalvikvm(2756): Debugger has detached; object registry had 1 entries
07-28 20:53:00.802: INFO/AndroidRuntime(2756): NOTE: attach of thread 'Binder Thread #3' failed
07-28 20:53:01.682: DEBUG/AndroidRuntime(2766): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
07-28 20:53:01.692: DEBUG/AndroidRuntime(2766): CheckJNI is ON
07-28 20:53:02.023: DEBUG/AndroidRuntime(2766): --- registering native functions ---
07-28 20:53:05.083: DEBUG/AndroidRuntime(2766): Shutting down VM
Does anyone have a clue WTF is going on here?
Looks like one of the framework-interaction shell commands is being launched repeatedly. If you type "adb shell am" you'll see similar output in the log file. Something in your development environment is going nutty.
Are you using Windows or Linux? Eclipse? The Android ADT plugin?
You can try "adb kill-server" to see if that's enough of a reset to stop whatever is going batty.