How to debug unexpected exceptions (source not found)

by Frank Weiss » Wed, 10 Feb 2010 10:38:49 GMT


Sponsored Links
 @Bob I don't think you really nailed the problem. I ran into what I think is
a similar issue. The stack trace showed the location of the throw deep in
the Android API, without a hint of a stack frame from my code. I suppose the
problem is because some of the Android code runs in different threads, so
that the exception was probably due to some data structure from my code that
the API later trips over in another thread.

I tried downloading the Android source code and adding it the the Android
project source code path. This solved the "no source found" error in the
Eclipse debugger, but unfortunately, the source code line where the
exception supposably was thrown didn't show any reasonably rational Android
code. I suppose the reason might have been that I pulled down the wrong
version of Android source.

In the end, my problems were due to not using the API correctly. In one case
it was trying to manipulate the UI from the AsyncTask.doInBackground method.
In another case it was because it was calling populate several times on a
Overlay object instead of just once after all the items had been added.

I'd still like to see an answer to the OP because it might be quite
educating to step through the Android source code. I usually figure out what
went wrong by looking at the the code that actually threw the exception and
seeing the data structure that caused it to barf.

--



Other Threads

1. Question about ExpandableList

Hi,all
    I have one question about ExpandableList.
    when I learned the sample of  ExpandableList ,I  found the
Constructor API about SimpleExpandableListAdapter,like this:

1               SimpleExpandableListAdapter(Context context, List<?
extends Map<String, ?>> groupData, int groupLayout, String[]
groupFrom, int[] groupTo, List<? extends List<? extends Map<String, ?


2       SimpleExpandableListAdapter(Context context, List<? extends
Map<String, ?>> groupData, int expandedGroupLayout, int
collapsedGroupLayout, String[] groupFrom, int[] groupTo, List<?
extends List<? extends Map<String, ?>>> childData, int childLayout,
String[] childFrom, int[] childTo)


3       SimpleExpandableListAdapter(Context context, List<? extends
Map<String, ?>> groupData, int expandedGroupLayout, int
collapsedGroupLayout, String[] groupFrom, int[] groupTo, List<?
extends List<? extends Map<String, ?>>> childData, int childLayout,
int lastChildLayout, String[] childFrom, int[] childTo)


    I used the 2rd Constructor and the two diff custom layout xml
files,but the result was not what I want. Only the
collapsedGroupLayout effected , when the ExpandableList group
expanded / collapsed.
    How can I get the correct result that when the ExpandableList
expand,the group uses the expandedGroupLayout and when the
ExpandableList collapse,the group uses the collapsedGroupLayout ?

--~--~---------~--~----~------------~-------~--~----~

2. Network access over 3G/EDGE

Hi there,

My application works fine in the emulator (using various target run
configurations) and on the device when the device is connected over
WiFi. But when I switch WiFi off on the device, the network access
code doesn't respond - i.e. takes forever and then times out. I don't
even see any data going out/coming in in the little 3G icon on the
status bar on the G1. Other people who are using the application are
reporting the same thing.

How can I debug this?

- F

--~--~---------~--~----~------------~-------~--~----~

3. Thumbnails problem

4. JXTA on Android

5. Cannot Install Android Development Kit for Eclipse

6. How to use headset button to pick up/hang up a call?

7. How to insert my service to severmanager and use it