realm / realm-java

Realm is a mobile database: a replacement for SQLite & ORMs
http://realm.io
Apache License 2.0
11.45k stars 1.75k forks source link

Fatal Exception: java.lang.IncompatibleClassChangeError #7822

Closed alberto-cappellina closed 6 months ago

alberto-cappellina commented 1 year ago

How frequently does the bug occur?

Sometimes

Description

Hi guys,

we released a newer version of our app and we are receiving some strange crash on crashlytics.

I can't understand which is the problem and - of course - it's not replicable, so i'm writing you to asking which one could be the cause of it

Stacktrace & log output

Fatal Exception: java.lang.IncompatibleClassChangeError: The method 'java.lang.Class java.lang.Object.getClass()' was expected to be of type interface but instead was found to be of type virtual (declaration of 'io.realm.DefaultRealmModuleMediator' appears in /data/app/com.dolomitisuperski.skiapp-zbIU4xyAjlUuv8QKsfTx3g==/base.apk:classes4.dex)
       at io.realm.DefaultRealmModuleMediator.copyOrUpdate(DefaultRealmModuleMediator.java:1190)
       at io.realm.Realm.copyOrUpdate(Realm.java:1844)
       at io.realm.Realm.copyToRealmOrUpdate(Realm.java:1433)
       at it.intesys.dolomitisuperski.common.persistency.PersistencyManager.clearTableAndSave$lambda-8$lambda-7(PersistencyManager.kt:79)
       at it.intesys.dolomitisuperski.common.persistency.PersistencyManager.$r8$lambda$Ge5sZIMPsuVe462oP_wnuR1kruI()
       at it.intesys.dolomitisuperski.common.persistency.PersistencyManager$$ExternalSyntheticLambda2.execute(:4)
       at io.realm.Realm.executeTransaction(Realm.java:1633)
       at it.intesys.dolomitisuperski.common.persistency.PersistencyManager.clearTableAndSave(PersistencyManager.kt:77)
       at it.intesys.dolomitisuperski.common.persistency.SeasonPersistencyManager$DefaultImpls.saveSeasons(SeasonPersistencyManager.kt:30)
       at it.intesys.dolomitisuperski.common.persistency.PersistencyManager.saveSeasons(PersistencyManager.kt:12)

Can you reproduce the bug?

No

Reproduction Steps

No response

Version

io.realm:realm-gradle-plugin:10.11.1"

What Atlas App Services are you using?

Local Database only

Are you using encryption?

No

Platform OS and version(s)

Android 8.0.0

Build environment

Android Studio version: Android Studio Electric Eel | 2022.1.1 Patch Android Build Tools version: 34-rc4 Gradle version: 7.2.0

clementetb commented 1 year ago

From the exception, it seems that it is an issue with your project setup. Could you share some details from the app gradle config? What minSdk are you targeting? Source compatibility?

alberto-cappellina commented 1 year ago

Thanks for the reply,

here's what you are asking:

    minSdkVersion 24
    targetSdkVersion 32

compileOptions {
    targetCompatibility = '1.8'
    sourceCompatibility = '1.8'
}

all crashes are on android 8, various brand

rorbech commented 11 months ago

Hi @alberto-cappellina. Sorry for the delay here. Are you still seeing this issue?

From what I can find on related issues is that it is an issue with binary compatibility. It is hard to replicate unless we get some more details on the characteristics on the devices exhibiting this. Maybe you could try to use 10.15.0 or newer where we raised the minimal supported Java version to Java 11.

alberto-cappellina commented 11 months ago

Hi @rorbech and thanks for the answer!

Yes sadly the issue is still present: the only characteristic that is recurring it is that all devices are android 8 based.

I'll try to update realm version to the suggested one (at least) and i'll get back to you

Thanks again, A

github-actions[bot] commented 10 months ago

This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.

alberto-cappellina commented 7 months ago

Hi, we updated the realm plugin to

    classpath "io.realm:realm-gradle-plugin:10.17.0"

but i'm still seeing the same issue. Always and only on Android 8.

Any idea? Any more detail needed?

clementetb commented 6 months ago

@alberto-cappellina can you reproduce it on an emulator or is device specific? Could you write a sample project that reproduces the issue? It would help massively tracking down it.

github-actions[bot] commented 6 months ago

This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.