Community

Community Forums

Where our customers, developers, and more can come together to help each other with both general and technical questions about our products and services.

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

Sudhir Singh

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.

Please sign in to leave a comment.

0
Avatar

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

chilun liu 0 votes
Comment actions Permalink
0
Avatar

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.

Sudhir Singh 0 votes
Comment actions Permalink
0
Avatar

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"

Sudhir Singh 0 votes
Comment actions Permalink
0
Avatar

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

chilun liu 0 votes
Comment actions Permalink
0
Avatar

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.

Sudhir Singh 0 votes
Comment actions Permalink
0
Avatar

Understood, that was for Eclipse.

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

chilun liu 0 votes
Comment actions Permalink
0
Avatar

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.

Sudhir Singh 0 votes
Comment actions Permalink
0
Avatar

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

chilun liu 0 votes
Comment actions Permalink
0
Avatar

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?

Sudhir Singh 0 votes
Comment actions Permalink
0
Avatar

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"/>
chilun liu 0 votes
Comment actions Permalink
0
Avatar
<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.
Sudhir Singh 0 votes
Comment actions Permalink
0
Avatar

You can use the following as the "Android:name"

com.urbanairship.UrbanAirshipProvider

 

 

 

 

chilun liu 0 votes
Comment actions Permalink
0
Avatar

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

Sudhir Singh 0 votes
Comment actions Permalink
0
Avatar

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);
}
chilun liu 0 votes
Comment actions Permalink
0
Avatar

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.

Sudhir Singh 0 votes
Comment actions Permalink