Android :: Debugging Native Code (C++) Using Gdb With Eclipse / Is It Possible?
May 24, 2010
I have some piece of code which uses JNI. I can debug code wrote in Java directly in Eclipse (using ADT). I even have a script, which help me debug native code with gdb. However this is not very comfortable way for doing this.Is it possible to configure Eclipse to use gdb (I guess gdbserver) for debbuging android native applications? Do you know where I could find any description of this?
I am trying to figure out what is the best way to debug a mix of Java and native code? Please notice, that I am NOT trying to develop a native app. The app will be written entirely in Java, using Android SDK. However, I noticed that some pieces of the SDK use native methods (e.g. AssetManager, WebKit, etc). I wonder which tools Google developers use if/when they need to debug a mix of Java and C/C++ code? Eclipse/gdb or there are commercial tools which make the debugging experience less painful?
I am new to android development and have been playing around with the tutorials offered at developer.android.com.I don't have a problem with projects I create from scratch, but when I start a project from the android sample code provided at android.com or from any other android project, I can never seem to get the bugs out to even run the thing.For example, when loading up the NotePad sample in the android-7 package of samples.would like a general solution, something more global bc this is occurring whenever I pull in anyone's source code from outside.kind of frustrated because I feel that I am spending too much time working out these kinks and not being able to study other people's code against how it performs in the emulator.
I have seen in the Android NDK release, presently NDK team is working on java to Native debugging? In the next release it may be there? when will be the next release of Android NDK? and Does they will support through eclipse ADT?
I am starting with Android programming with the help of Unlocking Android / Manning which came from Santa and is a pretty good book. After running a few little tests and examples, I'm moving towards developing the concepts for my own application.I want my App to execute as a Home Widget and I'm using this example as my model to get started.While I am able to load and run in the Android ADB emulator the code example in the example's Wiktionoary which is a normal Android App. I am not able to run, but only load into the emulator the Widget version of that code named SimpleWiktionary.Am I am able to debug Android Home Widgets with the emulator? If so, what am I missing on starting/activating the Widget or having it show up in the Apps window?
I've turned on USB debugging.I have the latest HTC Sync and android SDK components.I'm using Eclipse 3.5 on windows XP. I'm running Android 2.2, and am asking for 2.1 as the minimum in the debugger.I work in Eclipse/Java just about every day, and have for several years.I'm even writing an Eclipse plugin at work as I type this neither Eclipse nor Java are new to me by quite a stretch.When I start a debug session for the "Skeleton App" sample project, I can see my Evo, and the activity launches (with any freshly saved changes), should I select it.I have tried different android connection types (charge only, disk drive, HTC Sync, and USB tethering) to no avail. I've tried Eclipse 3.6 for a bit before yielding to the inevitable and reinstalling 3.5. I monkeyed with the emulator for a while but ran into a different set of issues (I had to reboot the emulator every time I wanted to make a change... Eclipse's auto-build/hot-swap has me spoiled).Is there something I can add to (or remove from) the AndroidManifest.XML to deal with this? A magical incantation perhaps? Must I pray towards San Jose three times a day on a rug woven from kernel gurus' vast and scruffy beards? Is my Evo not Kosher? Must I be "sky clad" while debugging? Shall I teach my laptop to genuflect?
When I run my app on my phone from eclipse, it always runs in debug. This has only recently started to happen. I guess I must have inadvertently changed a preference or something, but can't work out what. Does anyone know how I can switch it back so I can run without debugging?
I've obviously been spoiled by Visual Studio, because although I'm just learning Android and the Eclipse environment, debugging apps in Eclipse is becoming a serious detriment to further development.And then, when it executes it under the debugger, I will get a full screen of useless debug info, non of which actually points me to the specific line containing the error.The stackTrace is null within the exception ('e') info tree, and it simply states a message stating 'ArithmeticException'. (that's nice, how about you point me in the direction of where you found it!?)I've looked all over the screen and am baffled that this IDE can't get this right. Does developing with Eclipse resort everyone back to 1991 with printf() like logging at every interval then to track down bugs? Seriously.Is there a configuration or plug-in that I'm missing to help with this?I haven't tested this case with XCode, but if the iPhone dev. IDE handles this more like Visual Studio, then no wonder the Android marketplace has so few apps.
I've read the lame documentation, and checked other answers.I'd like my Android app to print some debug statements in the logcat window of Eclispe. If I use the isLoggable method on the various types of debug levels on the Log class, I find that WARN and INFO are returning true and Log.i do not produce any output.Does anyone know which gotchas I've missed?And just to vent, why should this be hard? I've published apps for iphone and bberry and while appreciate the use of java, the platform is reeking of too many "genuiuses" being involved. I suppose Activities and Intents are very flexible, but why? I just want to put up some screens, take some input and show some results. The bberry pushscreen and popscreen is a lot less pretentious.
I am just starting to learn Android development using the Android SDK and Eclipse. I can get my HelloWorld starting app to run in the device emulator, but not on my Verizon Droid handset. I have downloaded the drivers for Windows 7 and I can see the files on the handset in Windows Explorer, so I'm assuming I have the drivers working. I have enabled the USB Debugging on the handset.The problem is that when I set the Debug mode to Manual in Eclipse, I do not see my device in the "Choose device" list.What am I missing?
I am trying to debug android source code with ecliplse. And I can see that eclipse has connect to emulator via ddms. And I can see the log coming out from eclipse, but when I select an process in DDMS, and trying to debug the process, process can't stop on the breakpoint I have set.I think there might be some thing incorrect somewhere. Can anybody give some advice?
I've many times debugged my Java EE code running on Tomcat and JBoss quite effectivley with Eclipse, but I'm running into a brick wall debugging an Android app on the Droid. I think I have to debug on the device and not the AVM because the app interacts with MapView, GPS, etc. Maybe I need to use the AVM to effectively debug?What happens is I get NullPointerException or ArrayOutOfBoundsException in the main thread at something like ViewRoot.draw(boolean) line: 1373. Of course, by default, the source won't be found. So I downloaded the source with Git and pointed Eclipse at it. However, I think I don't have the right source, because the line is that the exception appears to have been thrown from is not completely relevant. How can I be sure I'm using the correct source code for debugging the Droid? After writing this, I've found that although Eclipse is not displaying the little green dot when I set a breakpoint in the Andorid code, it does show up in the breakpoint view and I can step through the code. Not sure if this helps me. Is it perhaps my ignorance of Dalvik and/or debugging threaded code?
How can I debug some system process (...acore), for example, the status bar, in Eclipse ? I couldn't find any help online yet. I'm able to debug a normal application, but not system threads (windowManagerSevice etc).Also, when I open the Android source in Eclipse using the official instructions, I get build errors, is it OK ? (already executed "make" successfully)
I've installed the Android SDK and the ADT plugin, but Android doesn't show up in the Window>Preferences dialog.I'm running Galileo. If I go to the Installation Details part of the About Eclipse dialog, it says that I have 0.9.6 of Android DDMS and Android Development Tools. I can run adb from the command line. I tried going around the uninstall/reinstall loop once.I'm on Windows Vista. I also have 2.7.7 of the Scala plugin installed, but I tried uninstalling that.
I have a Android phone connected with host computer with USB cable. ADB runs well and I can debug application on phone. The only problem is that the App requires special network setup which I can reach on host but not mobile. Is there a way to let the device send all network operations through ADB and Host network?
the Java sources for the Android framework are available at source.android.com. Can I download and feed them to Eclipse so that I can step into framework methods while debugging? Better yet, does anyone know of an Eclipse plug-in that would get them from Android Git automatically as needed?during debugging, I can step through the framework code; I can see local variables by their declared names, and line numbers as well. It seems like the debug info is already there - only the source file is missing. While I can open it in parallel and watch the execution unfold, the question of version matching remains. Of many versions of the class file in Git, how do I pick one that matches whatever is running on the device (or emulator)? This is more of a Git navigation question - how do I pick up the very version of the file that went into Android release, say, 2.2?
I am a newbie to Android and the Eclipse development environment and would like some advice on best practices for debugging my apps when they throw a Force Close.I have researched ADB, however, I can not get this to interact with my phone even though I have explicitly turned debug mode to true on my test handset.Obviously Android comes with a LOG method which I have seen utilized in many example apps, can someone please explain how to review these logs quickly and how to setup logging appropriately to determine the cause of a Force Close (always occurs when I push the Home button).Any advice on debugging effectively in Eclipse would be much appreciated!
I am developing a simple android application using eclipse.I wrote a JUnit TestCase for a class I wrote.One particular test compares two 2d arrays so see if they are equal. If they are not equal the test fails.When the test fails I would like to print out the contents of the offending array to see what went wrong. I have tried System.out.print and it doesn't show up in the console or JUnit results.What am I doing wrong?Is it even possible?
I am developing on Windows machine.I was working quite well until yesterday, when I saw the the update prompt and updated my ADT plugin. Today when I tried debugging my test project, I experienced either one the following cases:
1) Logcat stops forever on the message "sending wait chunk".
2) Logcat shows the following message, and test project fails:
3) Eclipse stops responding.
The above cases happens even when the test unit contains nothing.Also it just doesn't not work in debug. The test case runs successfully if it is not in debug mode (But there are still some glitches, like Logcat sometimes won't emit debug messages).
While doing debugging with Eclipse I noted that the debugger highlights the wrong line as "next line to execute" for methods with multiple return points. It fools the developer that the last line of the method is executed, where in fact it is not.Does anyone know if this is some kind of known issue? My colleagues have also experienced this but we have never seen it when doing on- device-debugging on e.g. the Sony Ericsson SDK.I couldn't find anything at http://code.google.com/p/android/issues/list There was a similar post in android-beginners 2007-11-25. No replies, though. http://groups.google.com/group/android-beginners/browse_thread/thread.
I have a library written in C which implements some complicated algorithm over two databases and as a result produce new one. I am trying to import it in android using android-ndk. What is the correct wat to use sqlite in you native libraries, i was able to build the sqlite manually using the ndk but when i use it gives some strange errors when trying to fetch rows from db which is on phone storate - after i fetch some data i got SQL:database not opened. how can use sqlite in native code on android.
We know that it's very convenient to use TraceView in Android java code to check the runtime of different chunks of code. Now I develop my app with NDK and I want to check the runtime of some native functions, but I found nothing in TraceView guide if it's possible to use this tool. Because I noticed that one of my native methods spent too much time and I want to dig out the more detailed root cause. Is there anybody know if we can use TraceView in native code?
I am planning to write a video player application and I am planning to use the gstreamer on the native side. I am trying to use the SurfaceFlinger for the rendering part. For this I have written a test program to experiment on the rendering part. I am using the surface flinger wrapper from the project
1. command line ' adb shell am instrument -w com.example.android.apis.tests/android.test.InstrumentationTestRunner'
2. Go to 'Dev' and clicks 'Instrumentation' and click 'Test API Demo'.But my questions now is, how can I debug my unit test cases? I try 'Debug' my APIDemoTest eclipse project and then do #2 above, it did not break at any of my breakpoints I setup.
I can't get adb to recognising my HTC Desire on my new upgrade of Ubuntu 10.10 Maverick Meerkat.adb devices shows List of devices attached no permissions Now, there are plenty of tutorials for changing rule files under /etc/udev/rules.d/.However, I cannot find one specific for 10.10.Can anyone tell me whether the rule file name and content is the same as described at link text, or are we looking at some new settings for this new release?
Is this possible to access a sensor data form native code without using Java at all? I need to access to the sensor as fast as possible, but it seems like the "DELAY_FASTEST" parameter when registering an event change is not fast enough.
I set out to use SkCanvas and other native SKIA classes but I could not find any sample code. After a week's of search and diving deep into Android source, I got it working. Below in my blog, I have detailed, how to use SimpleJNI native sample, to get native canvas going. If you find it useful or I did something wrong let me know http://matthiyosi.blogspot.com/2009/10/using-skia-in-android-native-c...