anthony
anthony

Reputation: 7723

ClassNotFoundException with DexPathList

I have this exception sometimes on my Samsung S3 (4.4 SDK version):

Caused by java.lang.ClassNotFoundException: Didn't find class "android.graphics.drawable.Icon" on path: DexPathList[[zip file "/data/app/com.xxxx-1.apk", zip file "/data/data/com.xxxx/code_cache/secondary-dexes/com.xxxx-1.apk.classes2.zip"],nativeLibraryDirectories=[/data/app-lib/com.xxxx-1, /vendor/lib, /system/lib]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)

I followed exactly these elements: https://developer.android.com/studio/build/multidex.html

On my Samsung S5 (6 SDK), there is no problem.

Upvotes: 10

Views: 2616

Answers (1)

ephemient
ephemient

Reputation: 205024

See the documentation; android.graphics.drawable.Icon was added in API level 23 (Android 6.0 Marshmallow). It does not exist on older devices.

Depending on your needs, android.support.v4.graphics.drawable.IconCompat could be used instead. It was added in support library 26.0.0, so you need to include com.android.support:support-compat:26.0.0 or newer (currently the latest is 26.0.1) as a dependency, as well as targetSdkVersion matching the support library. Support library 26 allows for a minimum SDK level 14.

Upvotes: 1

Related Questions