question

justinsouter avatar image
justinsouter asked justinsouter commented

App crashes on Station (orig) with ClassNotFoundException

Our production app works fine on a variety of devices, but is crashing on an old Station. I've reproduced this with an Android API 17 emulator. The unhandled exception is:

Unable to get provider com.loyalpatron.app.providers.TenderInfoImageProvider: java.lang.ClassNotFoundException: Didn't find class "com.loyalpatron.app.providers.TenderInfoImageProvider" on path: /data/app/com.loyalpatron.app-2.apk

I've checked build.gradle and see:

minSdkVersion 17
Clover Station
10 comments
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Seems like it could be a dex issue. Have you investigated that?

0 Likes 0 ·
justinsouter avatar image justinsouter David Marginian ♦♦ ·

Pardon my ignorance, but what is dex?

0 Likes 0 ·
justinsouter avatar image justinsouter David Marginian ♦♦ ·

It's a very small app, so unlikely to be hitting the 64k ref limit. Still, since the multidex build modifications were simple I tried them, but unfortunately got the same crash.

0 Likes 0 ·

Crashes every time? Or sporadically?

0 Likes 0 ·
justinsouter avatar image justinsouter Jeffrey Blattman ♦♦ ·

Every time.

0 Likes 0 ·

The next step would be to decompile the APK and see if that class exists. The question is if proguard is removing it. That seems unlikely but it's the next thing to check.

0 Likes 0 ·
Show more comments

1 Answer

· Write an Answer
Jeffrey Blattman avatar image
Jeffrey Blattman answered justinsouter commented

Here's your bug:

 06-17 13:49:53.378 E/AndroidRuntime( 9804): Caused by: java.lang.NoClassDefFoundError: java.nio.charset.StandardCharsets   06-17 13:49:53.378 E/AndroidRuntime( 9804):     at org.apache.commons.io.Charsets.<clinit>(Charsets.java:120)   06-17 13:49:53.378 E/AndroidRuntime( 9804):     ... 12 more  

StandardCharsets was added in API 19:

https://developer.android.com/reference/java/nio/charset/StandardCharsets

Station 1 is API 17.

Edit: to add a little more, looks like you are using org.apache.commons.io, which is a Java library. That's okay but you need to make sure the Java version of the library doesn't exceed to equivalent API level of the device. API 17 is roughly equivalent to Java 6, and StandardCharsets was added in Java 7.

1 comment
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

I'm confused. Why doesn't that StandardCharsets message show up with I debug, and I'm getting the TenderInfoImageProvider missing message? I've searched for StandardCharsets and can't find it referenced. I've searched for org.apache.commons.io and can't find it referenced. I'm a veteran developer, but newish to Android, so it could be my lack of experience showing. Thanks for your help.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community