Trying to follow the getting started After adding ...
# realm
b
Trying to follow the getting started After adding dependencies project now won’t compile
java.lang.AssertionError: Recursion detected in a lazy value under LockBasedStorageManager@3fb4777a (TopDownAnalyzer for JVM)
at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassDescriptor.getCompanionObjectDescriptor(LazyClassDescriptor.java:448)
at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassDescriptor.getCompanionObjectDescriptor(LazyClassDescriptor.java:64)
at org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt.getClassValueTypeDescriptor(DescriptorUtils.kt:118)
at org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt.getClassValueType(DescriptorUtils.kt:124)
at org.jetbrains.kotlin.resolve.scopes.receivers.ClassQualifier.<init>(Qualifier.kt:69)
at org.jetbrains.kotlin.resolve.QualifiedExpressionResolver.storeQualifier(QualifiedExpressionResolver.kt:801)
at org.jetbrains.kotlin.resolve.QualifiedExpressionResolver.storeResult(QualifiedExpressionResolver.kt:790)
at org.jetbrains.kotlin.resolve.QualifiedExpressionResolver.storeResult$default(QualifiedExpressionResolver.kt:760)
at org.jetbrains.kotlin.resolve.QualifiedExpressionResolver.resolveToPackageOrClassPrefix(QualifiedExpressionResolver.kt:519)
at org.jetbrains.kotlin.resolve.QualifiedExpressionResolver.resolveToPackageOrClassPrefix$default(QualifiedExpressionResolver.kt:480)
at org.jetbrains.kotlin.resolve.QualifiedExpressionResolver.resolveToPackageOrClass(QualifiedExpressionResolver.kt:468)
at org.jetbrains.kotlin.resolve.QualifiedExpressionResolver.resolveQualifierPartListForType(QualifiedExpressionResolver.kt:141)
at org.jetbrains.kotlin.resolve.QualifiedExpressionResolver.resolveDescriptorForType(QualifiedExpressionResolver.kt:129)
n
Hi @Barry Fawthrop can you please attach your project?
b
Nabil Not my whole project I’m upgrading an existing project I can share parts but this is just adding the dependencies that it fails
n
Sure whatever helps us reproduce the issue (models, gradle files etc.)
b
I haven’t got to create models yet I have just completed adding the dependencies to the gradle file and now it won’t compile
Copy code
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0-native-mt")
    implementation("io.realm.kotlin:library-sync:0.10.0")

    implementation("io.ktor:ktor-client-core:1.6.7")
    implementation("io.ktor:ktor-client-okhttp:1.6.7")
    implementation("io.ktor:ktor-client-gson:1.6.7")
    implementation("io.ktor:ktor-client-json:1.6.7")
    implementation("io.ktor:ktor-client-logging:1.6.7")
Copy code
implementation("com.google.code.gson:gson:2.8.9")    implementation("androidx.multidex:multidex:2.0.1")
    implementation("androidx.constraintlayout:constraintlayout:2.1.3")
    implementation("androidx.appcompat:appcompat:1.4.1")
    implementation("androidx.activity:activity-ktx:1.4.0")
    implementation("androidx.fragment:fragment-ktx:1.4.1")
Copy code
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.4.1")
implementation("androidx.work:work-runtime-ktx:2.7.1")

implementation("androidx.recyclerview:recyclerview:1.2.1")
implementation("androidx.percentlayout:percentlayout:1.0.0")
implementation("androidx.core:core-ktx:1.7.0")
n
which version of Kotlin are you using? I suppose this is an Android only project and not KMM?
b
Correct Android only not KMM 1.6.10
Copy code
ext.kotlin_version = "1.6.10"
n
I created a test project based on your description https://github.com/nhachicha/test and couldn't reproduce the issue. Can you pull the project and add any configuration elements that is close enough to your original project in order to reproduce?
b
I’m finding something so I have
class MealDetailAdapter(private val meals: List<MealItems>) : RecyclerView.Adapter<MealDetailAdapter.MealDetailViewHolder>() {
which internally has
Copy code
class MealDetailViewHolder(val view: LayoutMealDetailRowBinding) : RecyclerView.ViewHolder(view.root) {
Yet if I move the ViewHolder class OUTside the Adapter class it then moves on to the next Adapter I have many and they are all set up the same way
n
How is this impacting the failure? is the way you use the recycler view adapter driving this error?
b
I’m not sure I added --stacktrace and --debug and then it kept referencing my Adpaters I simply moved the ViewHolder class outside the Adapter and then it accepted it and moved to the next one
n
just to follow, so you don't have the
AssertionError
if you move the ViewHolder as you described?
b
correct
n
I'm not sure how this is related to Realm, but I'll try to create a recycler view with a
ViewHolder
inside the
RecyclerView.Adapter
to see if I can reproduce it ...
b
Another thing I’m finding is if you have
Copy code
kapt("androidx.annotation:annotation:1.3.0")
kapt("com.github.bumptech.glide:compiler:4.13.0")
It doesn’t like this either I had this so I could have GlideApp and not just Glide.with Removing these I finally got it to compile
Now it seems like Realm doesn’t like ktor? It compiles but I’m getting a new error see channel
c
It shouldn’t be an issue to use ktor along with Realm. You can see an example project of this in https://github.com/realm/realm-kotlin-samples/tree/main/Bookshelf. In fact we are also using it internally for our sync variant.