Class not found after multidexing

compile ""


I'm receiving a runtime exception with missing class com.urbanairship.job.AirshipGcmTaskService.  It looks like it's a dexing issue.  I looked at the github project and AirshipGcmTaskService is clearly in your manifest.  Can anyone think of a reason why dexing would drop this class?  I've also updated my to have -keep class com.urbanairship.** { *; }.

Didn't find what you were looking for?

New post



  • Hi Andrew,

    Multidex is a bit of a tricky feature to work with sometimes.

    Once you have multidexed your application, there are a few bits of information you'll need to add to your application to make it work.

    One of these things is making sure you've enabled multidexing within your build.gradle file, and added the necessary entries to the android manifest.

    I'm sure you've already read through the MultiDex documentation, but I would verify that you have enabled the implemented the steps outlined in that doc.

    Once you've done that, we can take a deeper look at things and see where we might be missing something.

    Comment actions Permalink
  • Thanks for your response.

    I've double checked the MultiDex documentation to make sure I'm doing everything correctly.  As far as I can tell, the documentation has been followed.


    Additions to builde.gradle

    multiDexEnabled true
    compile ""


    The Application object extends MultiDexApplication and contains the overwritten method:

    protected void attachBaseContext(Context base) {



    Should I include all urbanairship classes as required classes in the primary DEX file?  I wonder, if a user receives a push, the launching of my application has trouble recognizing urbanairship classes while it's starting up.

    Comment actions Permalink
  • Andrew,

    If your application class is already extending MultiDexApplication, then you don't need to override the attachBaseContext method.

    Try removing that instead and see if that resolves any of the errors.

    Comment actions Permalink
  • Interesting.  Unfortunately, I'm unable to reliably reproduce the crash, but I may give that a shot and throw my app back into production to see what happens.  I definitely now see in the documentation where it warns about ClassNotFoundExceptions if you do that.

    Comment actions Permalink

Please sign in to leave a comment.