Reputation: 494
i'm getting this class not found error on api's below 21 even though google said it supports till api 14
i have tried it on android studio 3.0 beta 6
09-19 17:12:39.273 2794-2794/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: xxxx, PID: 2794
java.lang.RuntimeException: Unable to get provider android.arch.lifecycle.LifecycleRuntimeTrojanProvider: java.lang.ClassNotFoundException: Didn't find class "android.arch.lifecycle.LifecycleRuntimeTrojanProvider" on path: DexPathList[[zip file "/data/app/xxxx-1.apk"],nativeLibraryDirectories=[/data/app-lib/xxxx-1, /vendor/lib, /system/lib]]
at android.app.ActivityThread.installProvider(ActivityThread.java:4793)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4385)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4325)
at android.app.ActivityThread.access$1500(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.arch.lifecycle.LifecycleRuntimeTrojanProvider" on path: DexPathList[[zip file "/data/app/xxxxx-1.apk"],nativeLibraryDirectories=[/data/app-lib/xxxxx-1, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
I've been using kotlin for development.
// architecture components
implementation "android.arch.lifecycle:runtime:$arch_version"
implementation "android.arch.lifecycle:extensions:$arch_version"
kapt "android.arch.lifecycle:compiler:$arch_version"
arch version is the latest one ext.arch_version = '1.0.0-alpha9-1' building tool -> ext.buildToolsVersion = '26.0.1'
i have checked the other solutions says disable minify and proguard i have already tested them
debug {
// applicationIdSuffix '.debug' // Remove to fix Robolectric problem
versionNameSuffix '-DEBUG'
debuggable true
minifyEnabled false
useProguard false
multiDexEnabled true
Upvotes: 4
Views: 5898
Reputation: 83
I was having the same problem, my app wouldn't run in api 19 devices (4.4) and it was a Dex problem.
I followed google documentation on multidex to solve it
1 - in app gradle, inside defaultConfig enable multidex
defaultConfig{
....
multiDexEnabled true
}
2 - to support multidex in other versions, add this dependency to your app gradle
compile 'com.android.support:multidex:1.0.1'
3 - if you have a class that extends Application, make it extend MultiDexApplication
if you don't, add this to your manifest file inside application tag
android:name="android.support.multidex.MultiDexApplication"
that's it. worked for me
Upvotes: 3
Reputation: 412
Disabling Instant Run worked for me. (Settings -> Build, Execution, Deployment -> Instant Run -> uncheck "Enable Instant Run")
Upvotes: 3