Closed DmytroTols closed 1 month ago
➤ PM Bot commented:
Jira ticket: RKOTLIN-1074
It is similar to this other report.
Can you reproduce the issue locally? Do you use any custom provider? Would you mind sharing a project that reproduces the issue?
Where are you calling this code?
val appInitializer = AppInitializer.getInstance(this)
appInitializer.initializeComponent(RealmInitializer::class.java)
Are you removing the Initializer provider and using this code?
Where are you calling this code?
val appInitializer = AppInitializer.getInstance(this) appInitializer.initializeComponent(RealmInitializer::class.java)
Are you removing the Initializer provider and using this code?
Yes, I'm removing initializer in manifest and call this code in my class MainClass that inheritance from Application:
class MainApplication : Application() {
private val log: Logger = LoggerFactory.getLogger(MainApplication::class.java)
override fun onCreate() {
super.onCreate()
LogContext.init()
startKoin {
androidContext(this@MainApplication)
}
startFirebase()
startStoreSdk()
val appInitializer = AppInitializer.getInstance(this)
appInitializer.initializeComponent(RealmInitializer::class.java)
}
It is similar to this other report.
Can you reproduce the issue locally? Do you use any custom provider? Would you mind sharing a project that reproduces the issue?
Yes, it is similar to this issue, but the solutions that worked for this issue didn't work for mine , also I'm not using compose multiplatform, im using old approach with kotlin, i will try to re-create this issue in small demo and will link it
I found solutions to my problem, my issue was that i had realm in module, in my module manifest i had
Sometimes this was called before io.realm.kotlin.internal.RealmInitializer, i fixed it by calling manually
override fun create(context: Context) {
val appInitializer = AppInitializer.getInstance(context)
appInitializer.initializeComponent(RealmInitializer::class.java)
Database.init(context)
Database.getOrCreateRealm()
}
How frequently does the bug occur?
Sometimes
Description
I'm trying to initialize realm config when app starts with and then call Realm.open(realmConfig!!) when i will need it, but on call init: fun init(context: Context) { realmConfig = RealmConfiguration.Builder( schema = setOf( TransactionEntity::class, // more classes TaxEntity::class ) ) .name(DATABASE_NAME) .schemaVersion(DATABASE_VERSION) .encryptionKey(getOrCreateEncKey(context)) .migration(Migration()) .build() }
Stacktrace & log output
Can you reproduce the bug?
Sometimes
Reproduction Steps
Issue occurs on start of the app
Version
1.15.0
What Atlas App Services are you using?
Local Database only
Are you using encryption?
Yes
Platform OS and version(s)
Android 10
Build environment
Android Studio version: Iguana | 2023.2.1 Patch 2 Android Build Tools version: Android SDK Build-Tools 35-rc3 Gradle version: 7.5