Frequently crashing due to "unable to get provider com.urbanairship.urbanairshipprovider"

Hi Team,

Our app is crashing frequently with following exception and its happening in few devices.

unable to get provider com.urbanairship.urbanairshipprovider: java.lang.classnotfoundexception: didn't find class "com.urbanairship.urbanairshipprovider" on path: dexpathlist

We have enabled mutlidex and enabled "MultiDex.install(base)" in our application class.

Can you please let us now the solution for this.

Didn't find what you were looking for?

New post

Comments

16 comments

  • Hello Sudhir,

    May I ask which versions of the Airship SDK and Android API you are using?

    Is it also possible for you state where exactly you enabled "MultiDex.install(base)" in your application class? Have you considered moving "MultiDex.install(base)" into the "attachBaseContext" method?

    Kind regards,

    Chilun Liu

    Airship Support

    0
  • Hi Chilun,

    Thanks for the response.

    We are using SDK with 9.0.2 version. We have enabled "MultiDex.install(base)" in application class's attachBaseContext method.

    Please let me know if any other information required.

    0
  • Can you tell me which Android API version you are using?

    Also with multidex, I think you may have to declare the provider in the primary dex file:

    https://developer.android.com/studio/build/multidex.html#keep

    0
  • We are using target sdk version as 28 and compile sdk version as 27.

    And we have declared the provider in multidex file and adding that to the build config. following is the snippet how we added that in multidex.

    "com/urbanairship/UrbanAirshipProvider.class"

    0
  • Can you check if your "Android Private Libraries" are enabled in your project properties?

    Just go to the Project -> Properties -> Java Build Path -> Order and Export and check Android Private Libraries

    0
  • I don't see those settings in Android Studio. Are you referring to Eclipse setting or Android Studio.

    FYI, we are using Android Studio for our development.

    0
  • Understood, that was for Eclipse.

    Is it possible for me to take a look at your build.gradle and android manifest?

    0
  • We should not be sharing those details, can you please let us know what exactly you would like to examine in those files. so that i can do on behalf of you.

    0
  • Lets start with the "provider" in the manifest, do you have android:authorities="com.my.package.urbanairship.provider" in there?

    0
  • No We don't have that in our Manifest, can you please share how exactly it should be added there.

    android:authorities="com.my.package.urbanairship.provider"

    my.package -  refers to my application package?

    0
  • my.package -  refers to my application package? yes

    Here is how it is defined:

    <provider
        android:name="provider"
        android:authorities="com.my.package.urbanairship.provider"
        android:exported="false"/>
    0
  • <provider
        android:name="provider" 
        android:authorities="com.my.package.urbanairship.provider"
        android:exported="false"/>
    please help me understand following details from above snippet
    android:name="provider" - As we are just adding Urbanairship sdk as dependancy to our project, this provide won't be directly available. So what should we mention here as provider name.
    com.my.package.urbanairship.provider - Similar to above as we don't local copy of provider what should we mention here.
    0
  • You can use the following as the "Android:name"

    com.urbanairship.UrbanAirshipProvider

     

     

     

     

    0
  • Yeah, I have added that. any other changes required?

    0
  • The next step is the build grade, do your multidex entries look like this?

    multiDexEnabled true
    compile "com.android.support:multidex:1.0.1"

    Does your application object extend MultiDexApplication and overrides attachBaseContent?

    @Override
    protected void attachBaseContext(Context base) {
    super.attachBaseContext(base);
    MultiDex.install(this);
    }
    0
  • Hi Chilun,

    We have the following line in our build.graddle

    multiDexEnabled true

    compile "com.android.support:multidex:1.0.1"  -  this is not added

    and our application is not extending MultiDexApplication  but its Application class and attachBaseContext() overriden with following snippet.

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

    Now i have changes as per your input, can we know the next steps please.

    0

Please sign in to leave a comment.