When I debug android app, if I work with Java, I can use Log.d("TAG", "xxxx", new Throwable()) to print backtrace of Java code. This is really handy for me to find bugs. But when I work with native library (e.g. libwebcore.so), there seems no way to print backtrace in runtime. The only way to debug native code is use gdbserver.
I have a question: Is there any way to print backtrace in C/C++?
I'm trying to debug my native JNI code located on a shared library. I have been trying to debug using gdb/gdbserver.
Here is how I go about, trying to debug:
How to debug JNI native code on the Android emulator I'm using gdb/gdbserver I do this at the emulator terminal gdbserver localhost:
when I step on the Android Java code so the function Java_testJNI_printHello is called, I get this error on the server side gdb: Unable to get location for thread creation breakpoint: requested event is not supported
I've got some trouble with the media backend (mostly Stagefrightplayer) in Android, and I'd like to understand why it throws the errors it does. The errors are usually device spesific, so debugging on an emulator wouldn't be sufficient.
I've also gotten the player to bork completely and spit out a traces.txt.
Is there a way to debug what's happening, just like I debug Java code?
I am programming Android applications, and the best way here may or may not be the same as Java in general.I simply want to be able to set a debug flag that will only execute certain portions of code when it's set to true equiv to C++ setting a preprocessor #define DEBUG and using #ifdef DEBUG.Is there an accepted or best way to accomplish this in Java?
Right now I'm just going to set a variable in my Application object, but I don't imagine this is the best way.
I have a activity B that is called by activity A, I want to debug the code in B. I have set the breakpoint, however the debug control never enters B.
When I debug in eclipse, although the class B is called from class A, the debbugger pointer never enters the new window, where I have placed a debug point in Class B. I am not able to take the pointer control to class B and stop at a specific point, which will help me verify certain variable values.
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
I wanted to understand what the $ sign and the number after a $ sign meant in a backtrace. For example, consider the following backtrace: at android.app.Activity Thread.access$ 2500 (ActivityThread.java:115) at android.app.Activity Thread$H.handleMessage (ActivityThread . java : 1745) In the first line, what does the number 2500 refer to? In addition, I couldn't find the function "access" in ActivityThread.java, and line 115 is just the beginning of the class. Can anyone help clarify this?
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...
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?
We want to migrate a huge complex native program to Android system ,running it as a background service accepting command sent from Java Program using JNI along with IPC. However, the Android NDK state following words:
Please note that the NDK does not enable you to develop native-only applications. Android's primary runtime remains the Dalvik virtual machine.
Does that mean we have no way to run an standalone native-only application on Android as a background service? The native code can only exist in the form of library that will be loaded to the virtual machine through JNI?
I am creating an Android application which uses the JMF (SIP, RTP, JAIN). So i downloaded the JMF source code for some adhoc change to my application.The basic questions 1. How will it behave the "native files - C/C++/header" in JMF source files(downloaded)? because android is based on java right now. 2. Is there any complete different way to porting/doing the SIP, RTP working in android?Is there any link from sun.com(this) site for JMF source code?Any suggestion and comment about this?
I was able to setup my android project to call a native function from a .so file. And actually I need to add box2d to my project, but I when I include the header files, it won't make. So basically my problem is how do I tell the make file to include a whole folder with header and cpp files.
I tried adding the path directly to the include statement just for the sake of testing it. The error goes away, but new errors come out.
I am trying out an example of OpenCV from http://github.com/billmccord/OpenCV-Android and am stuck at the point where it is mentioned "Before attempting to run the VideoEmulator application, you must first copy this XML file into the emulator in the following location: /data/data/org.siprop.opencv/files/haarcascade_frontalface_alt.xml " Where in my eclipse workspace do I need to place this haar xml file to be copied to the location /data/data/org.siprop.opencv/files/ of the emulator?
Try to select (or update) from custom databases (for example mmssms.db) but on init I see " Unable to open the database file". Try send permissions in manifest <uses-permission android:name="android.permission.WRITE_SMS"/> <uses-permission android:name="android.permission.READ_SMS"/> but this doesn't help.
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 wrote an iPhone app some time ago that creates sound programatically. It uses an AudioQueue to generate sound. With the AudioQueue, I can register for a callback whenever the system needs sound, and respond by filling a buffer with raw audio data. The buffers are small, so the sound can respond to user inputs with reasonably low latency.
I'd like to do a similar app on Android, but I'm not sure how. The MediaPlayer and SoundPool classes seems to be for playing canned media from files, which is not what I need. The JetPlayer appears to be some sort of MIDI playback engine. Is there an equivalent to AudioQueue in the Android Java API? Do I have to use native code to accomplish what I want?
I started my emulator with ./emulator -trace profile -avd emulator_15. I then tracked down the trace files to ~/.android/avd/rodgers_emulator_15.avd/traces/profile, where there are six files: qtrace.bb, qtrace.exc, qtrace.insn, qtrace.method, qtrace.pid, qtrace.static. I can't figure out what to do with these files. I've tried both dmtracedump and traceview on all of the files, but none seem to generate any output I can do anything with.
How can I view the proportion of time taken by native method calls on Android?