Vishnu Shrikar
11/04/2023, 5:46 AMjw
11/04/2023, 12:14 PMVishnu Shrikar
11/04/2023, 7:24 PMefemoney
11/05/2023, 5:01 PMVishnu Shrikar
11/05/2023, 5:04 PMVishnu Shrikar
11/06/2023, 4:02 AMJeff Lockhart
11/06/2023, 4:07 AMVishnu Shrikar
11/06/2023, 4:10 AMJeff Lockhart
11/06/2023, 5:22 AMVishnu Shrikar
11/06/2023, 5:29 AMJeff Lockhart
11/06/2023, 5:38 AMVishnu Shrikar
11/09/2023, 3:29 AMJeff Lockhart
11/09/2023, 3:37 AMCouchbaseLite.init()
should be optional in Kotbase, as it is automatically initialized under the hood, here on JVM and here on Android. Other platforms don't require init. You can call the init
function with arguments if needed, but the API is only available in JVM and Android platform code.
If you can, share the code you're finding isn't working for you.kotbase
package. If you're using the com.couchbase.lite
package directly (which is only accessible in JVM or Android platform code), then it will throw an exception for not initializing the library.Vishnu Shrikar
11/09/2023, 3:54 AMpackage com.mypackage.name.database
import com.couchbase.lite.CouchbaseLite
import com.couchbase.lite.Database
import inject
class Database {
init {
CouchbaseLite.init()
}
private val database: Database by inject()
val p = database.name
}
inline fun <reified T> inject() = org.koin.java.KoinJavaComponent.inject<T>(T::class.java)
import com.couchbase.lite.Database
object InjectableModules {
private const val DATBASE_NAME = "appDb"
fun module() = org.koin.dsl.module {
single<Database> {
Database(DATBASE_NAME)
}
single<com.mypackage.name.database.Database> {
com.mypackage.name.database.Database()
}
}
}
Jeff Lockhart
11/09/2023, 3:58 AMimport com.couchbase.lite.Database
to import kotbase.Database
. Then you can remove the init call.
Be sure to use the kotbase
package instead of com.couchbase.lite
, which is the underlying Couchbase Lite dependency. Typically if you have a native target, you won't even see this package from common code.Vishnu Shrikar
11/09/2023, 6:25 AMJeff Lockhart
11/10/2023, 5:24 AM