dagger icon indicating copy to clipboard operation
dagger copied to clipboard

Android ANR: NoClassDef when extending library classes

Open klassm opened this issue 11 years ago • 0 comments

Hi there,

I have recently integrated Dagger into my app. When rolling out the new application version, some users complained about black startup screens. The Android developer tools told me that they where encountering ANRs. Up to then, I had no chance to reproduce that issue locally. However, afterwards I found one device encountering the same issue - at least once, so that I could see the log message.

What I was doing was something like

public class GCMIntentService extends GCMBaseIntentService {
    @Override
    public void onCreate() {
        super.onCreate();
        ((MyApplication) getApplication()).inject(this);
    }
}

Unfortunately I did not save the log message - but it told me that GCMBaseIntentService, stemming from Google, could not be found.

When changing the application to

MyApplication.getApplication().getGraph().get(MyBean.class);

my users where happy again.

This is a somewhat strange bug which is really hard to find.

Matthias

klassm avatar Sep 11 '14 17:09 klassm