task from Gradle. I guess it runs on the emulator because it fails if you haven't started an emulator manually first. What do you mean with properties in
build.gradle.kts
. Can I define properties in the Gradle file that is available at runtime?
a
aleksey.tomin
06/16/2020, 8:39 AM
What the result of
HostManager.host_os()
in the build file?
a
Alexander Larsson
06/16/2020, 8:45 AM
It is always
osx
no matter which platform I build for. (JVM, Android, iOS)
Alexander Larsson
06/16/2020, 9:02 AM
Found a super simple solution:
Copy code
internal actual fun testSqlDriver(): SqlDriver {
try {
val context = InstrumentationRegistry.getInstrumentation().context
return AndroidSqliteDriver(Database.Schema, context, "androidtestdb")
}
catch (e: IllegalStateException) {
return JdbcSqliteDriver(JdbcSqliteDriver.IN_MEMORY).apply {
Database.Schema.create(this)
}
}
}
How did I not think of this before? 😅 Thanks for the help though! Did not know of host manager before. 🙂