Eclipse debugger stops at DexFile.defineClass on startup?

by thrusty » Sun, 30 Mar 2008 18:30:32 GMT

Sponsored Links
 When I upgraded to the latest SDK recently, I found that when I launch
my application under the Eclipse debugger (on Mac OS X 10.5.2), the
app consistently stops at DexFile.defineClass on startup. (Clicking
"Continue" allows the app to continue launching OK, as far as I can
tell.) There is no debug info available other than the stack trace
(pasted below), and a consistently printed line in LogCat:

DEBUG/(749): zip_openZipFile(/data/app/myapp.apk)

I'm trying to figure out if this is indicative of an actual error in
my application, or if this is simply a debugging configuration

Thanks for any help!

DexFile.defineClass(String, ClassLoader, int, ProtectionDomain) line:
not available [native method]
DexFile.loadClass(String, ClassLoader) line: 87
PathClassLoader.findClass(String) line: 165
PathClassLoader(ClassLoader).loadClass(String, boolean) line: 442
PathClassLoader(ClassLoader).loadClass(String) line: 414
Instrumentation.newActivity(ClassLoader, String, Intent) line: 821
line: 1691
line: 1770
ActivityThread.access$1500(ActivityThread, ActivityThread
$ActivityRecord) line: 99
ActivityThread$H.handleMessage(Message) line: 1271
ActivityThread$H(Handler).dispatchMessage(Message) line: 80
Looper.loop() line: 91
ActivityThread.main(String[]) line: 3052
Method.invokeNative(Object, Object[], Class, Class[], Class, int,
boolean) line: not available [native method]
Method.invoke(Object, Object...) line: 356
ZygoteInit$ line: 1547
ZygoteInit.main(String[]) line: 1445
NativeStart.main(String[]) line: not available [native method]


Eclipse debugger stops at DexFile.defineClass on startup?

by thrusty » Tue, 01 Apr 2008 16:55:35 GMT

 This appears to be related to implementing View.OnKeyListener in an
Activity.  For some reason DexFile.defineClass doesn't like this, and
causes the debugger to stop in this native method.

I'll file a bug report.


Sponsored Links

Eclipse debugger stops at DexFile.defineClass on startup?

by thrusty » Tue, 01 Apr 2008 17:02:59 GMT

 Scratch that-- it was simply a matter of a breakpoint being
(accidentally) set at the class-definition level (i.e. a breakpoint
set in Eclipse on the line "public class MyActivity..."

I guess the way the Android emulator handles this kind of breakpoint
is to stop in DexFile.defineClass.  Lesson learned!


Other Threads

1. Google analytics - dispatch frequency in android app?


I was looking at using google analytics for android. We can use the
basic template below to record "page views":

public class MyActivity extends Activity {

    private GoogleAnalyticsTracker tracker;

    protected void onCreate(Bundle savedInstanceState) {

        tracker = GoogleAnalyticsTracker.getInstance();
        tracker.trackPageView("/test/" + getClass().getSimpleName());

    protected void onDestroy() {


I wonder if anyone else is doing this, and if it's a significant
battery drain? Ideally I wouldn't have to dispatch() on every
onDestroy(), I'd rather move the dispatch() call to be called once at
each app startup. But I'm not sure if the tracker persists all this
data for you between application runs. The docs don't say much about

So, in other words, will this work?:

public class MyApp extends Application {
    public void onCreate() {
        // If tracker in fact does persist all my tracks between app
sessions, then push them
        // all up only once every time the app starts?
        GoogleAnalyticsTracker tracker =



2. Gingerbread / Nexus S

Good?, Bad?, Ugly?


And to start off I'll say I think the Nexus S is waaayyy overpriced. In the UK 
it'll cost 80 more than the Galaxy Tab (that's around US$120 more)


Funky Android Limited is registered in England & Wales with the company number  

The views expressed in this email are those of the author and not necessarily 
those of Funky Android Limited, it's associates, or it's subsidiaries.


3. wifi scanning problem

4. Google TV Device

5. AnimationDrawable scaling

6. Gingerbread on Nexus anyone?

7. make JPEG image as a google map