Eclipse debugger not working with Android appWidget application? - android

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?

Related

Qt for Android debugging issues

I have setup a kit in Qt Creator to deploy my applications to Android. Looked at https://wiki.qt.io/Qt_for_Android_known_issues, and ended up with:
Qt Creator 4.3.1
Qt 5.9.1
NDK: r10e
SDK: r25.2.5
I deploy to a tablet running Android 5.1.1.
"Run" Works fine. My applications is deployed, started, and crashes hard. Therefor I'd like to debug, but that does not go so well. Before my app even starts I get the error "Connecting to remote server failed:
Attaching to process 6285 failed"
ADB logcat:
I/Qt ( 5981): qt start
D/houdini ( 5981): [5981] Added shared library /data/data/org.qtproject.example.gui/qt-reserved-files/plugins/bearer/libqandroidbearer.so for ClassLoader by Native Bridge.
D/houdini ( 5981): [5981] Added shared library /data/data/org.qtproject.example.gui/qt-reserved-files/plugins/position/libqtposition_android.so for ClassLoader by Native Bridge.
I/QtPositioning( 5981): Positioning start
I/Qt JAVA ( 5981): DEBUGGER: extra parameters: Bundle[{debug_ping=true, gdbserver_socket=/data/data/org.qtproject.example.gui/debug-socket, qml_debug=true, gdbserver_command=/data/data/org.qtproject.example.gui/lib/libgdbserver.so --multi +/data/data/org.qtproject.example.gui/debug-socket, qmljsdebugger=port:38509,block,services:DebugMessages,QmlDebugger,V8Debugger,QmlInspector, ping_socket=org.qtproject.example.gui.ping_pong_socket}]
I/Qt JAVA ( 5981): DEBUGGER: removing gdb socket /data/data/org.qtproject.example.gui/debug-socket
I/Qt JAVA ( 5981): DEBUGGER: starting /data/data/org.qtproject.example.gui/lib/libgdbserver.so --multi +/data/data/org.qtproject.example.gui/debug-socket
I/Qt JAVA ( 5981): DEBUGGER: gdbserver started
I/Qt JAVA ( 5981): DEBUGGER: waiting for socket at /data/data/org.qtproject.example.gui/debug-socket, attempt 0
W/libgdbserver.so( 6001): type=1400 audit(0.0:13): avc: denied { module_request } for kmod="personality-8" scontext=u:r:untrusted_app:s0 tcontext=u:r:kernel:s0 tclass=system permissive=0
I/Qt JAVA ( 5981): DEBUGGER: waiting for socket at /data/data/org.qtproject.example.gui/debug-socket, attempt 1
I/Qt JAVA ( 5981): DEBUGGER: socket ok
I/Qt JAVA ( 5981): DEBUGGER: Waiting for debug socket connect
I/Qt JAVA ( 5981): DEBUGGER: go to sleep
I/Qt JAVA ( 5981): DEBUGGER: Waiting for debug socket connect
I/Qt JAVA ( 5981): DEBUGGER: go to sleep
I/Qt JAVA ( 5981): DEBUGGER: Waiting for debug socket connect
I/Qt JAVA ( 5981): DEBUGGER: go to sleep
I/Qt JAVA ( 5981): DEBUGGER: Waiting for debug socket connect
I/Qt JAVA ( 5981): DEBUGGER: go to sleep
I/Qt JAVA ( 5981): DEBUGGER: Waiting for debug socket connect
I/Qt JAVA ( 5981): DEBUGGER: go to sleep
I/Qt JAVA ( 5981): DEBUGGER: Debug socket accepted
I/Qt JAVA ( 5981): DEBUGGER: Waiting for debug socket connect
I/Qt JAVA ( 5981): DEBUGGER: go to sleep
I/Qt JAVA ( 5981): DEBUGGER: Waiting for debug socket connect
I/Qt JAVA ( 5981): DEBUGGER: go to sleep
D/AndroidRuntime( 6008): >>>>>> START com.android.internal.os.RuntimeInit uid 2000 <<<<<<
D/AndroidRuntime( 6008): CheckJNI is OFF
W/art ( 6008): Could not create mount namespace.
W/ ( 6008): Failed to bind-mount /system/lib/x86/cpuinfo as /proc/cpuinfo: Operation not permitted
E/ ( 6008): Cannot create code cache directory ./code_cache: Read-only file system.
I/Build ( 6008): Restore serial number.
D/AndroidRuntime( 6008): Calling main entry com.android.commands.am.Am
I/ActivityManager( 2911): Force stopping org.qtproject.example.gui appid=10080 user=0: from pid 6008
I/ActivityManager( 2911): Killing 5981:org.qtproject.example.gui/u0a80 (adj 0): stop org.qtproject.example.gui
I/libprocessgroup( 2911): Killing pid 6001 in uid 10080 as part of process group 5981
D/ActivityManager( 2911): cleanUpApplicationRecord -- 5981
I/ActivityManager( 2911): Force finishing activity 3 ActivityRecord{1325d u0 org.qtproject.example.gui/org.qtproject.qt5.android.bindings.QtActivity t20}
W/ActivityManager( 2911): Spurious death for ProcessRecord{90e0893 5981:org.qtproject.example.gui/u0a80}, curProc for 5981: null
Try this:
get the installation folder for your app:
adb shell run-as <package name of your app> /system/bin/sh -c pwd
then change the file attributes on that folder:
adb shell run-as <package name of your app> chmod "a+x" <output of previous command>
You can get your package name from the android manifest file. After that, debugging from Qt Creator should work fine - or it did for me.

Android emulator stuck in boot loop -library "/system/lib/libnetcmdiface.so" not found

I have tried to boot my emulator on three different platforms windows 7, ubuntu 12.04 and kubuntu 13.10(fresh install). However it always stops here with the logcat looping with the output below.
Could anyone help me figure this out. It is quite frustrating and I have lost close to a week of development.
D/AndroidRuntime( 3143): >>>>>> AndroidRuntime START com.android.internal.os.ZygoteInit <<<<<<
D/AndroidRuntime( 3143): CheckJNI is ON
E/dalvikvm( 3143): Can't create markStack
W/dalvikvm( 3143): CreateJavaVM failed: dvmGcStartup failed
E/AndroidRuntime( 3143): JNI_CreateJavaVM failed
I/Netd ( 3161): Netd 1.0 starting
W/InterfaceController( 3161): Warning (dlopen failed: library "/system/lib/libnetcmdiface.so" not found) while opening the net interface command library
D/AndroidRuntime( 3162):
I run into similar issue when I replaced libcrypto.so with my version. As restored /system/lib/libcrypto.so with original copy, things worked fine.
This happened unexpectedly on my Android 12 emulator. It would no longer boot up, and instead just get stuck on the black screen that has the word "android" in white letters, with a gray fade animation over the letters.
The logcat output would just have repeated displays of this every 10 seconds or so:
E/AndroidRuntime( 3143): JNI_CreateJavaVM failed
I couldn't find a way to fix it, so I just deleted the emulator and recreated it again, in Android Studio -> Tools -> Device Manager -> Create Device -> select a suitable screen size and a name -> Next -> press the tab "x86 Images" -> then select the Android 12 API 31 image that you have already downloaded.

Unable to debug android app on target

I am trying to create a new app with Eclipse. Things seem to work fine if I run through the emulator, but I cannot deploy it to my phone.
I have an original Motorola Droid, rooted running Gingerbread.
In the console, I get:
[2011-05-30 15:13:30 - MapsDemo] ------------------------------
[2011-05-30 15:13:30 - MapsDemo] Android Launch!
[2011-05-30 15:13:30 - MapsDemo] adb is running normally.
[2011-05-30 15:13:30 - MapsDemo] Performing com.example.android.apis.MapsDemo activity launch
[2011-05-30 15:13:30 - MapsDemo] Automatic Target Mode: Unable to detect device compatibility. Please select a target device.
[2011-05-30 15:13:34 - MapsDemo] WARNING: Application does not specify an API level requirement!
[2011-05-30 15:13:34 - MapsDemo] Device API version is 10 (Android
2.3.4)
[2011-05-30 15:13:34 - MapsDemo] Uploading MapsDemo.apk onto device '0403626109009013'
[2011-05-30 15:13:35 - MapsDemo] Installing MapsDemo.apk...
[2011-05-30 15:13:35 - MapsDemo] Success!
[2011-05-30 15:13:35 - MapsDemo] Starting activity com.example.android.apis.MapsDemo on device 0403626109009013
And in logcat I get:
05-30 15:30:11.922: DEBUG/AndroidRuntime(5718): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
05-30 15:30:11.922: INFO/AndroidRuntime(5718): Heap size: -Xmx40m
05-30 15:30:11.922: DEBUG/AndroidRuntime(5718): CheckJNI is OFF
05-30 15:30:11.922: WARN/dalvikvm(5718): JNI_CreateJavaVM failed
05-30 15:30:11.922: ERROR/AndroidRuntime(5718): JNI_CreateJavaVM failed
05-30 15:30:12.164: DEBUG/AndroidRuntime(5721): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
05-30 15:30:12.164: INFO/AndroidRuntime(5721): Heap size: -Xmx40m
05-30 15:30:12.164: DEBUG/AndroidRuntime(5721): CheckJNI is OFF
05-30 15:30:12.164: WARN/dalvikvm(5721): JNI_CreateJavaVM failed
05-30 15:30:12.164: ERROR/AndroidRuntime(5721): JNI_CreateJavaVM failed
05-30 15:30:12.406: DEBUG/AndroidRuntime(5725): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
05-30 15:30:12.406: INFO/AndroidRuntime(5725): Heap size: -Xmx40m
05-30 15:30:12.406: DEBUG/AndroidRuntime(5725): CheckJNI is OFF
05-30 15:30:12.406: WARN/dalvikvm(5725): JNI_CreateJavaVM failed
05-30 15:30:12.406: ERROR/AndroidRuntime(5725): JNI_CreateJavaVM failed
When I look on my phone, it doesn't seem like it is actually uploading the apk, even though it says it succeeded.
What have I done wrong? I tried searching for solutions, but I haven't had much luck...
Did you enable USB Debug and install from Unknown Sources on your Android device?
Make sure you have the android:debuggable="true" in your AndroidManifest.xml
<application android:debuggable="true" android:name=".MyApp" android:icon="#drawable/icon" android:label="#string/app_name">

Android Eclipse failing to debug

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.

AndroidRuntime thrashing

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.

Categories

Resources