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

'class com.szchsen.xim.data.RealmSession' is not part of the schema for this Realm. #7841

Closed Gavin-we closed 1 year ago

Gavin-we commented 1 year ago

How frequently does the bug occur?

Always

Description

I updated the gradle version to 7.5 and the plugin version, but got this error log, I don't know what caused it, I didn't change it for RealmSession, it was fine before.

Stacktrace & log output

My ERROR LOG :

[uncaughtException]:printStackTrace:
 io.realm.exceptions.RealmException: 'class com.szchsen.xim.data.RealmSession' is not part of the schema for this Realm.
                                                                                                        at io.realm.internal.RealmProxyMediator.getMissingProxyClassException(RealmProxyMediator.java:234)
                                                                                                        at io.realm.DefaultRealmModuleMediator.getSimpleClassNameImpl(DefaultRealmModuleMediator.java:106)
                                                                                                        at io.realm.internal.RealmProxyMediator.getSimpleClassName(RealmProxyMediator.java:72)
                                                                                                        at io.realm.RealmSchema.getTable(RealmSchema.java:177)
                                                                                                        at io.realm.RealmSchema.getSchemaForClass(RealmSchema.java:200)
                                                                                                        at io.realm.RealmQuery.<init>(RealmQuery.java:155)
                                                                                                        at io.realm.RealmQuery.createQuery(RealmQuery.java:94)
                                                                                                        at io.realm.Realm.where(Realm.java:1431)
                                                                                                        at com.szchsen.xim.storage.MsgStorageManager.getSessionStorage(MsgStorageManager.java:83)
                                                                                                        at cc.sachsen.bgim.user.mvp.activity.ConversationHistoryCleanerActivity$loadStorageData$2.invokeSuspend(ConversationHistoryCleanerActivity.kt:497)
                                                                                                        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
                                                                                                        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
                                                                                                        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
                                                                                                        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
                                                                                                        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
                                                                                                        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
2023-08-16 11:47:18.406  1513-1990  InputDispatcher         system_server                        E  channel '9e1ba95 cc.sachsen.bgim.user/cc.sachsen.bgim.user.mvp.activity.ConversationHistoryCleanerActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
2023-08-16 11:47:18.406  1513-1990  InputDispatcher         system_server                        E  channel 'a538f8f cc.sachsen.bgim.user/cc.sachsen.bgim.user.mvp.activity.StorageSpaceActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
2023-08-16 11:47:18.407  1513-1990  InputDispatcher         system_server                        E  channel '8b8abf3 cc.sachsen.bgim.user/cc.sachsen.bgim.user.mvp.activity.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!

Can you reproduce the bug?

Always

Reproduction Steps

No response

Version

API 31;Android 12.0(s)

What Atlas App Services are you using?

Both Atlas Device Sync and Atlas App Services

Are you using encryption?

No

Platform OS and version(s)

no

Build environment

Android Studio version: 17.0.6+0-b2043.56-9586694 amd64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. Android Build Tools version: 7.4.2 Gradle version: 7.5

build gradle(Project) : apply from: 'config.gradle'

buildscript { ext.kotlin_version = '1.7.20'

repositories {

// maven{ url 'https://maven.aliyun.com/repository/google'}//google // maven{ url 'https://maven.aliyun.com/repository/public'}//jcenter jcenter() mavenCentral() google() maven { url "https://www.jitpack.io" } maven{ url 'https://oss.jfrog.org/artifactory/oss-snapshot-local' } maven {url 'https://developer.huawei.com/repo/'} } dependencies { classpath 'com.android.tools.build:gradle:7.4.2' classpath 'com.alibaba:arouter-register:1.0.2' classpath 'io.objectbox:objectbox-gradle-plugin:2.6.0' classpath 'io.realm:realm-gradle-plugin:6.1.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.16' classpath 'com.huawei.agconnect:agcp:1.5.2.300' classpath 'com.google.gms:google-services:4.3.10' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files

    classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
}

}

allprojects { repositories { // maven{ url 'https://maven.aliyun.com/repository/google'}//google // maven{ url 'https://maven.aliyun.com/repository/public'}//jcenter jcenter() mavenCentral() google() maven { url "https://www.jitpack.io" } maven{ url 'https://oss.jfrog.org/artifactory/oss-snapshot-local' } maven {url 'https://developer.huawei.com/repo/'} } }

task clean(type: Delete) { delete rootProject.buildDir } build gradle(app): apply plugin: 'com.android.application' apply plugin: 'com.huawei.agconnect' apply plugin: 'kotlin-android' //apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-kapt' //得在 kotlin-android 后面 apply plugin: 'io.objectbox' //得在 kotlin-kapt 后面 apply plugin: 'realm-android' apply plugin: 'com.alibaba.arouter' apply plugin: 'com.google.gms.google-services' apply plugin: 'com.google.protobuf'

android { compileSdkVersion rootProject.ext.versions['compileSdkVersion']

defaultConfig {
    applicationId rootProject.ext.versions['applicationId']
    minSdkVersion rootProject.ext.versions['minSdkVersion']
    targetSdkVersion rootProject.ext.versions['targetSdkVersion']
    versionCode rootProject.ext.versions['appVersionCode']
    versionName rootProject.ext.versions['appVersionName']
    multiDexEnabled true

    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

    resValue "string", "google_search_api_key", (project.findProperty("GOOGLE_SEARCH_API_KEY") ?: "")
    resValue "string", "google_map_api_key", (project.findProperty("GOOGLE_MAP_API_KEY") ?: "")

    javaCompileOptions {
        annotationProcessorOptions {
            arguments = [AROUTER_MODULE_NAME: project.getName()]
        }
    }

    ndk {
        abiFilters 'arm64-v8a'//'armeabi', 'armeabi-v7a', 'x86', 'x86_64', 'arm64-v8a'
    }
}

signingConfigs {
    release {
        keyAlias rootProject.ext.key['keyAlias']
        keyPassword rootProject.ext.key['keyPassword']
        storeFile rootProject.ext.key['storeFile']
        storePassword rootProject.ext.key['storePassword']
    }
}

buildTypes {
    release {
        signingConfig signingConfigs.release
        debuggable false
        shrinkResources true
        zipAlignEnabled true
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }

    debug {
        signingConfig signingConfigs.release
        debuggable true
        minifyEnabled false
    }

    applicationVariants.all { variant ->
        variant.outputs.all {
            outputFileName = "xim-${variant.buildType.name}-v${variant.versionName}-${new Date().format("MMdd-HH")}.apk"
        }
    }
}

compileOptions {
    targetCompatibility rootProject.ext.versions['javaVersion']
    sourceCompatibility rootProject.ext.versions['javaVersion']
}

lintOptions {
    abortOnError false
}

task cleanDebugTemp {
    doFirst {
        //intermediates/javac/debug/classes/io/realm
        deleteClassFile("${projectDir}/build/intermediates/javac/debug/classes/io/realm/DefaultRealmModule.class")
        deleteClassFile("${projectDir}/build/intermediates/javac/debug/classes/io/realm/DefaultRealmModuleMediator.class")
    }
}
task cleanReleaseTemp {
    doFirst {
        deleteClassFile("${projectDir}/build/intermediates/javac/release/classes/io/realm/DefaultRealmModule.class")
        deleteClassFile("${projectDir}/build/intermediates/javac/release/classes/io/realm/DefaultRealmModuleMediator.class")
    }
}