realm / realm-kotlin

Kotlin Multiplatform and Android SDK for the Realm Mobile Database: Build Better Apps Faster.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Runtime android app crash

RakeshPatil111 opened this issue · comments

How frequently does the bug occur?

Always

Description

IllegalStateException: Incomplete hierarchy for class RealmObject, unresolved classes [io.realm.kotlin.types.TypedRealmObject]
Getting exception, when creating configuration.
Defined entity classes as follow
class Sample: RealmObject, Entity {}
Entity is custom class having two attributes.

Stacktrace & log output

Non-fatal Exception: java.lang.IllegalStateException: Incomplete hierarchy for class RealmObject, unresolved classes [io.realm.kotlin.types.TypedRealmObject]
       at kotlin.reflect.jvm.internal.impl.descriptors.runtime.components.RuntimeErrorReporter.reportIncompleteHierarchy(RuntimeErrorReporter.java:26)
       at kotlin.reflect.jvm.internal.impl.serialization.deserialization.descriptors.DeserializedClassDescriptor$DeserializedClassTypeConstructor.computeSupertypes(DeserializedClassDescriptor.kt:245)
       at kotlin.reflect.jvm.internal.impl.types.AbstractTypeConstructor$supertypes$1.invoke(AbstractTypeConstructor.kt:78)
       at kotlin.reflect.jvm.internal.impl.types.AbstractTypeConstructor$supertypes$1.invoke(AbstractTypeConstructor.kt:77)
       at kotlin.reflect.jvm.internal.impl.storage.LockBasedStorageManager$LockBasedLazyValue.invoke(LockBasedStorageManager.java:408)
       at kotlin.reflect.jvm.internal.impl.storage.LockBasedStorageManager$LockBasedLazyValueWithPostCompute.invoke(LockBasedStorageManager.java:481)
       at kotlin.reflect.jvm.internal.impl.storage.LockBasedStorageManager$LockBasedNotNullLazyValueWithPostCompute.invoke(LockBasedStorageManager.java:512)
       at kotlin.reflect.jvm.internal.impl.types.AbstractTypeConstructor.getSupertypes(AbstractTypeConstructor.kt:27)
       at kotlin.reflect.jvm.internal.impl.serialization.deserialization.descriptors.DeserializedClassDescriptor$DeserializedClassMemberScope.getNonDeclaredVariableNames(DeserializedClassDescriptor.kt:355)
       at kotlin.reflect.jvm.internal.impl.serialization.deserialization.descriptors.DeserializedMemberScope$OptimizedImplementation$variableNames$2.invoke(DeserializedMemberScope.kt:262)
       at kotlin.reflect.jvm.internal.impl.serialization.deserialization.descriptors.DeserializedMemberScope$OptimizedImplementation$variableNames$2.invoke(DeserializedMemberScope.kt:261)
       at kotlin.reflect.jvm.internal.impl.storage.LockBasedStorageManager$LockBasedLazyValue.invoke(LockBasedStorageManager.java:408)
       at kotlin.reflect.jvm.internal.impl.storage.LockBasedStorageManager$LockBasedNotNullLazyValue.invoke(LockBasedStorageManager.java:527)
       at kotlin.reflect.jvm.internal.impl.storage.StorageKt.getValue(Storage.kt:42)
       at kotlin.reflect.jvm.internal.impl.serialization.deserialization.descriptors.DeserializedMemberScope$OptimizedImplementation.getVariableNames(DeserializedMemberScope.kt:261)
       at kotlin.reflect.jvm.internal.impl.serialization.deserialization.descriptors.DeserializedMemberScope.getVariableNames(DeserializedMemberScope.kt:60)
       at kotlin.reflect.jvm.internal.impl.serialization.deserialization.descriptors.DeserializedClassDescriptor$DeserializedClassMemberScope.getNonDeclaredVariableNames(DeserializedClassDescriptor.kt:356)
       at kotlin.reflect.jvm.internal.impl.serialization.deserialization.descriptors.DeserializedMemberScope$OptimizedImplementation$variableNames$2.invoke(DeserializedMemberScope.kt:262)
       at kotlin.reflect.jvm.internal.impl.serialization.deserialization.descriptors.DeserializedMemberScope$OptimizedImplementation$variableNames$2.invoke(DeserializedMemberScope.kt:261)
       at kotlin.reflect.jvm.internal.impl.storage.LockBasedStorageManager$LockBasedLazyValue.invoke(LockBasedStorageManager.java:408)
       at kotlin.reflect.jvm.internal.impl.storage.LockBasedStorageManager$LockBasedNotNullLazyValue.invoke(LockBasedStorageManager.java:527)
       at kotlin.reflect.jvm.internal.impl.storage.StorageKt.getValue(Storage.kt:42)
       at kotlin.reflect.jvm.internal.impl.serialization.deserialization.descriptors.DeserializedMemberScope$OptimizedImplementation.getVariableNames(DeserializedMemberScope.kt:261)
       at kotlin.reflect.jvm.internal.impl.serialization.deserialization.descriptors.DeserializedMemberScope$OptimizedImplementation.addFunctionsAndPropertiesTo(DeserializedMemberScope.kt:349)
       at kotlin.reflect.jvm.internal.impl.serialization.deserialization.descriptors.DeserializedMemberScope.computeDescriptors(DeserializedMemberScope.kt:115)
       at kotlin.reflect.jvm.internal.impl.serialization.deserialization.descriptors.DeserializedClassDescriptor$DeserializedClassMemberScope$allDescriptors$1.invoke(DeserializedClassDescriptor.kt:274)
       at kotlin.reflect.jvm.internal.impl.serialization.deserialization.descriptors.DeserializedClassDescriptor$DeserializedClassMemberScope$allDescriptors$1.invoke(DeserializedClassDescriptor.kt:273)
       at kotlin.reflect.jvm.internal.impl.storage.LockBasedStorageManager$LockBasedLazyValue.invoke(LockBasedStorageManager.java:408)
       at kotlin.reflect.jvm.internal.impl.storage.LockBasedStorageManager$LockBasedNotNullLazyValue.invoke(LockBasedStorageManager.java:527)
       at kotlin.reflect.jvm.internal.impl.serialization.deserialization.descriptors.DeserializedClassDescriptor$DeserializedClassMemberScope.getContributedDescriptors(DeserializedClassDescriptor.kt:284)
       at kotlin.reflect.jvm.internal.impl.resolve.scopes.InnerClassesScopeWrapper.getContributedDescriptors(InnerClassesScopeWrapper.kt:35)
       at kotlin.reflect.jvm.internal.impl.resolve.scopes.InnerClassesScopeWrapper.getContributedDescriptors(InnerClassesScopeWrapper.kt:27)
       at kotlin.reflect.jvm.internal.impl.resolve.scopes.ResolutionScope$DefaultImpls.getContributedDescriptors$default(ResolutionScope.kt:50)
       at kotlin.reflect.jvm.internal.KClassImpl$Data$nestedClasses$2.invoke(KClassImpl.kt:100)
       at kotlin.reflect.jvm.internal.KClassImpl$Data$nestedClasses$2.invoke(KClassImpl.kt:99)
       at kotlin.reflect.jvm.internal.ReflectProperties$LazySoftVal.invoke(ReflectProperties.java:93)
       at kotlin.reflect.jvm.internal.ReflectProperties$Val.getValue(ReflectProperties.java:32)
       at kotlin.reflect.jvm.internal.KClassImpl$Data.getNestedClasses(KClassImpl.java:99)
       at kotlin.reflect.jvm.internal.KClassImpl.getNestedClasses(KClassImpl.kt:240)
       at kotlin.reflect.full.KClasses.getCompanionObject(KClasses.kt:47)
       at kotlin.reflect.full.KClasses.getCompanionObjectInstance(KClasses.kt:57)
       at io.realm.kotlin.internal.platform.RealmObjectKt.realmObjectCompanionOrNull(RealmObject.kt:27)

Can you reproduce the bug?

Always

Reproduction Steps

Use kotlin realm in KMM code, create native android build and test on PlayStore build.

Version

1.14.0

What Atlas App Services are you using?

Local Database only

Are you using encryption?

No

Platform OS and version(s)

Android 14

Build environment

No response

➤ PM Bot commented:

Jira ticket: RKOTLIN-1064

My guess is that your ProGuard configuration is missing something. Please provide a full reproduction case for us to help you further.

My guess is that your ProGuard configuration is missing something. Please provide a full reproduction case for us to help you further.

HI Thanks for the input, can you provide expected proguard configuration?
Searched related to this but did not find anything.
I am using kotlin-realm 1.14.1, Android debug builds works perfectly but release build is throwing exception.

Without a reproduction case - or at least your proguard configuration - it is difficult to provide a good answer.

I did not add any proguard configuration for project.
The way I am using realm in project is different.
I have KMM project, which uses realm-kotlin sdk, android native code uses realm-java sdk, this may be causing the issue. Both SDKs are pointing to the same realm file.

It is a bit unclear what you mean by "android native code uses realm-java sdk", but have tried to elaborate a bit on the constraints of using both SDKs at the same time.

We don't support open a realm file with both SDKs at the same time. It is also dangerous to access the same realm file with different SDKs even if you don't try to do it simultaneous, as the two SDKs might be using core versions with different file formats.

When you are trying to combine two SDKs in the same app you have to be carefull to specify the model so that you don't get the Kotlin compiler plugin applied on the Java classes. This should be doable following the pattern of defining models from our Java-compatibility example.