Class not found after multidexing

compile "com.urbanairship.android:urbanairship-sdk:8.7.0"

 

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 proguard-rules.pro to have -keep class com.urbanairship.** { *; }.

Didn't find what you were looking for?

New post

Comments

4 comments

  • 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
    0
  • 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 "com.android.support:multidex:1.0.1"

     

    The Application object extends MultiDexApplication and contains the overwritten method:

    @Override
    protected void attachBaseContext(Context base) {
    super.attachBaseContext(base);
    MultiDex.install(this);
    }

     

    Suspicion:

    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
    0
  • 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
    0
  • 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
    0

Please sign in to leave a comment.