Realm-java: java.lang.ClassNotFoundException: Didn't find class "androidx.appcompat.R$drawable" on path: DexPathList[[zip file "

Created on 5 Jul 2019  路  9Comments  路  Source: realm/realm-java

Goal

Use Realm on my project

Project work fine without realm integration.

Actual Results

2019-07-05 16:01:56.240 2532-2532/app.duna.dunaxpay E/AndroidRuntime: FATAL EXCEPTION: main Process: app.duna.dunaxpay, PID: 2532 java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/appcompat/R$drawable; at androidx.appcompat.widget.AppCompatDrawableManager$1.<init>(AppCompatDrawableManager.java:63) at androidx.appcompat.widget.AppCompatDrawableManager.preload(AppCompatDrawableManager.java:57) at androidx.appcompat.app.AppCompatDelegateImpl.<init>(AppCompatDelegateImpl.java:315) at androidx.appcompat.app.AppCompatDelegateImpl.<init>(AppCompatDelegateImpl.java:265) at androidx.appcompat.app.AppCompatDelegate.create(AppCompatDelegate.java:221) at androidx.appcompat.app.AppCompatActivity.getDelegate(AppCompatActivity.java:543) at androidx.appcompat.app.AppCompatActivity.attachBaseContext(AppCompatActivity.java:98) at android.app.Activity.attach(Activity.java:7242) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3055) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3251) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1948) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:214) at android.app.ActivityThread.main(ActivityThread.java:7045) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965) Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.appcompat.R$drawable" on path: DexPathList[[zip file "/data/app/app.duna.dunaxpay-J7wI7w2xgDbhzmNVJIVCWQ==/base.apk"],nativeLibraryDirectories=[/data/app/app.duna.dunaxpay-J7wI7w2xgDbhzmNVJIVCWQ==/lib/arm64, /data/app/app.duna.dunaxpay-J7wI7w2xgDbhzmNVJIVCWQ==/base.apk!/lib/arm64-v8a, /system/lib64, /system/vendor/lib64]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134) at java.lang.ClassLoader.loadClass(ClassLoader.java:379) at java.lang.ClassLoader.loadClass(ClassLoader.java:312) at androidx.appcompat.widget.AppCompatDrawableManager$1.<init>(AppCompatDrawableManager.java:63)聽 at androidx.appcompat.widget.AppCompatDrawableManager.preload(AppCompatDrawableManager.java:57)聽 at androidx.appcompat.app.AppCompatDelegateImpl.<init>(AppCompatDelegateImpl.java:315)聽 at androidx.appcompat.app.AppCompatDelegateImpl.<init>(AppCompatDelegateImpl.java:265)聽 at androidx.appcompat.app.AppCompatDelegate.create(AppCompatDelegate.java:221)聽 at androidx.appcompat.app.AppCompatActivity.getDelegate(AppCompatActivity.java:543)聽 at androidx.appcompat.app.AppCompatActivity.attachBaseContext(AppCompatActivity.java:98)聽 at android.app.Activity.attach(Activity.java:7242)聽 at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3055)聽 at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3251)聽 at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)聽 at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)聽 at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)聽 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1948)聽 at android.os.Handler.dispatchMessage(Handler.java:106)聽 at android.os.Looper.loop(Looper.java:214)聽 at android.app.ActivityThread.main(ActivityThread.java:7045)聽 at java.lang.reflect.Method.invoke(Native Method)聽 at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)聽 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965)聽

Steps & Code to Reproduce

https://realm.io/docs/java/latest#installation

Version of Realm and tooling

Realm version(s): 5.12.0
Realm Sync feature enabled: No
Android Studio version: Android Studio 3.6 Canary 4
Android Build Tools version: 29.0.0
Gradle version: 5.4.1
Which Android version and device(s): minSdkVersion 22

Build #AI-191.7479.19.36.5679705, built on June 21, 2019
JRE: 1.8.0_202-release-1483-b03 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0

O-Community T-Duplicate

Most helpful comment

I solved this problem by migrating Realm-Java version from 5.8.0 to 6.1.0 馃槉

All 9 comments

I have exactly the same problem. How did you solve it?

I have this problem as well. Not sure what's causing it, currently I'm trying to check through my dependencies to see if anything is conflicting.

I have this problem as well. Not sure what's causing it, currently I'm trying to check through my dependencies to see if anything is conflicting.

I think my problem was constraintlayout, but I was tired of experimenting, so I returned to SQLite

I have this problem as well. Not sure what's causing it, currently I'm trying to check through my dependencies to see if anything is conflicting.

I think my problem was constraintlayout, but I was tired of experimenting, so I returned to SQLite

I thank that's the best alternative... returning to SQLite... Pfffff...

Is Realm compatible to multiDex ??

Is Realm compatible to multiDex ??

Should be, but you should invoke Multidex.install before you call Realm.init

I seem to have found the issue. While Multidex was enabled, it had nothing to do with my issue. I was using an Alpha version of the Android Gradle Plugin, which broke my build. I simply downgraded it to the latest stable version (3.4.2). After that, my project built successfully.

It is probably related the same as https://github.com/realm/realm-java/issues/6531
It is due to a change in the 3.6.0 plugin.

I'll close this as a duplicate of that.

I solved this problem by migrating Realm-Java version from 5.8.0 to 6.1.0 馃槉

July 2020 - I faced the same problem when updating one of my app to api 29, i.e. compileSdkVersion 29 and androidx libraries. What worked for me was also to update the Realm. My working module level build.gradle looks like this:

    dependencies {
        classpath 'com.android.tools.build:gradle:4.0.1'
        classpath "io.realm:realm-gradle-plugin:6.0.2"
    }

And gradle-wrapper.properties file:

distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip

My Java is at 1.8, i.e. in project level build.gradle:

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
Was this page helpful?
0 / 5 - 0 ratings

Related issues

CNyezi picture CNyezi  路  3Comments

harshvishu picture harshvishu  路  3Comments

Frasprite picture Frasprite  路  3Comments

nolanamy picture nolanamy  路  3Comments

AAChartModel picture AAChartModel  路  3Comments