Eclipse Debug mode & Exceptions - android

I'm sure this has been asked before, but I looked and don't see a definitive answer anywhere.
In eclipse, while debugging Android program, if I cause an exception Eclipse always wants to pull up the source file where the actual throw statement is contained. I don't have the source attached (nor do I want to), so it brings up this 'Source not found' window for android.jar every time I hit an exception.
I know I can look at the logcat to see the call stack, but is there any way to make eclipse automatically open the file that I caused the exception from (the deepest file in the call stack for which source exists), and not the android.jar? It seems like a trivial thing to do, but instead I'm always stuck looking at this useless page every time, when I think a smart solution would be to automatically pull up the file from my source code that caused the problem. Instead I have to look at the call stack, return back to 'java' view, and find the offending file myself and open it, which is pretty onerous.
Is there any way to improve my IDE setup so I get more useful information right away than looking at this useless class not found page?

Try using step filters (Editable in properties: Window - Preferences - Java - Debug - Step Filters).
That way you can ignore certain packages where you do not have the sources available.

Related

Firefox for Android: can't modify anything on about:config

TLDR: firefox for android does not show expected about:config screen.
Firefox: 39.0
Phone: Nexus 5
I am trying to install and configure an extension on firefox for Android.
I've been following these instructions, which work fine until I have to alter the filepath in about:config.
At this stage, I need to modify the settings to show firefox where a certain .txt file is. I can easily find the setting I wish to modify, but cannot find a way modify it.
The expected menu (with Modify) never shows up, and instead the only options I can get are "copy name" and "copy value".
Images of the expected interface, and actual interface:
Expected interface (from walk-through):
Actual interface (screenshot):
After searching, trying to find the modify option:
Eventually, with a lot of trial and error, got it fixed. The about:config interface has changed since the guide I was following was pasted, but it ended up being a very good step by step anyway.
Solution:
The new interface has an area where there is nothing written, which you need to over-write with the desired path (in my case it ended up being /storage/sdcard0/silent_block_directory).
Two pieces of advice to avoid making the same mistakes as I did:
1. Don't point the path at the .txt file, but rather at the parent directory
2. Don't look for the modify button, it does not exist any more.

"Source not found" when debugging SOME classes of the Android platform code

I'm using Eclipse Kepler with the latest ADT, and I have already set the Java Source Attachment for android.jar to point to the correct directory.
With this setup, I can place breakpoints and step into most classes/methods with no problems at all. However, for some classes, Eclipse just refuses to load the source, and instead displays the standard Source not found screen, although the corresponding source file (ScrollBarDrawable.java) is present in the source directory (under android\widget).
The particular example I have now is with the android.widget.ScrollBarDrawable class, but it has happened with others before.
How to reproduce:
Create a simple project with an EditText in the layout.
Call editText.setHorizontallyScrolling(true); in onCreate() (so that it needs to draw scrollbars) and enter long text into it.
Place a breakpoint in the onDrawScrollBars() method of the View class, on any calls to methods of the scrollBar object (e.g. line 11967 for android-19).
Try to step into this method.
Has anyone else experienced this?
Any tips on how to fix it, or at least an explanation of why it might be happening (as in: this class is somewhat different from the others)? I have already trying added additional File System Directory entries to the Edit Source Lookup Path dialog, to no avail.

using startMethodTracing and stopMethodTracing with ddms

I'd like to measure performance in a specific function (and everything it calls). To do so, it seems I should use Debug.startMethodTracing() and Debug.stopMethodTracing(), then somehow start DDMS tracing.
However, when I open a DDMS view in Eclipse and click the Start Method Profiling button, it starts immediately - not when startMethodTracing() executes. The result is a huge trace file with mostly irrelevant stuff in it. Too hard to narrow in (I tried a few times).
Apparently TraceView is deprecated. Should I hack a way to use that anyway? Is it any better? What is the correct approach to do what I need?
Thanks.
If you use Debug.startMethodTracing() and Debug.stopMethodTracing() a .trace file will be created on the device. The exact location of it is printed out in the logcat.
Look for entries that start with "TRACE STARTED" and "TRACE STOPPED". You then can use adb pull to get the .trace file from your device and open it in the tool of your choice for analysis (e.g. Eclipse or some third party product)
There is no need to manually use DDMS in Eclipse if you're using the above calls. The .trace file itself can simply be opened in Eclipse by using File -> Open

Modifying Android source code

I am absolutely new to Android. As a research curricular project, I want to make some changes in Android's activity manager's source code. I have downloaded the source code from here and built it for emulator. Now, to start with, I want to do some very simple things e.g. adding print statements to the module that I want to modify. This is just to make sure that my changes are actually showing effect. But how can I
See the changes I made. In this case, where can I see words/sentences printed by my print statements?
Even if I make such small change, do I need to build entire code base again using "make" command? Cant I just compile that particular class or file? I tried "mmm" and "mm" but they dont seem to be working. One says "nothing to build" even if I introduce syntax error and other says "no android.mk file found"
Can I add my own method to the ActivityManager class?
Thank you...

Building FFmpeg for Android

I've spent almost a week on this now, trying to get FFmpeg "Angel"/"Happiness" to build for Android.
I've tried build scripts from all over the internet to no avail. I got closest was using this. As the author himself says the script doesn't work for newer versions of FFmpeg due to this bug, which has been dismissed on that ticket saying "I found a Makefile that does it." This was dis-heartening, being the only post on all of the vast Google world that was anywhere close to my problem.
So, question time:
Is there a way to get around the above bug? I'm trying to use the newest ffmpeg API, and "Love" is just giving me "undefined reference" errors while trying to use av_encode_video2(), and av_free_frame(). The code I was working on the lines of is at the ffmpeg git repo, under /doc/examples/decoding_encoding.c (the function starting on line 338).
Update: So they've done away with codec_names.sh in "Angel". Sorry didn't notice that before, but the problem persists in a different avatar now. With every build attempt the compiler throws a certain
start ndk-building...
/home/<user>/android-ndk/build/core/build-binary.mk:41: *** target file `clean' has both : and :: entries. Stop.
Say whatnow!?
Given the lack of any response at all, I'm assuming people who know their shit in this topic are really busy putting their skills to use with whatever they managed to compile. For the ones like me who scraped each corner of the web for an answer that makes any little sense, I have a.. more than decent workaround.
The Guardian Project, an awesome resource on github, has the perfect project set up for building an ffmpeg binary with all the settings of your choice. But just the one big problem of getting it to successfully build sans the "Unable to create executables" error.
So.. there's a way out there too. Less flexible, but it saves you from losing any more hair than I'm sure you (like me) already have. Head out here and profit.
From running the file command I noticed this binary was dynamically linked, that seemed weird, but it works.
Also, you'll have to run the chmod command before using it on the device (being a binary file and all). So pop it into your res/raw/ folder, load it up when needed and edit those videos like there's no tomorrow!

Categories

Resources