4.5 KiB
Vendored
See an Android project example.
Kotlin DataFrame doesn't provide a dedicated Android artifact yet, but you can add the Kotlin DataFrame JVM dependency to your Android project with minimal configuration:
dependencies {
// Core Kotlin DataFrame API, CSV and JSON IO.
// See custom Gradle setup:
// https://kotlin.github.io/dataframe/setupcustomgradle.html
implementation("org.jetbrains.kotlinx:dataframe-core:%dataFrameVersion%")
implementation("org.jetbrains.kotlinx:dataframe-json:%dataFrameVersion%")
implementation("org.jetbrains.kotlinx:dataframe-csv:%dataFrameVersion%")
// You can add any additional IO modules you like, except for 'dataframe-arrow'.
// Apache Arrow is not supported well on Android.
}
android {
defaultConfig {
minSdk = 21
}
// Requires Java 8 or higher
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}
dependencies {
// Core Kotlin DataFrame API, CSV and JSON IO.
// See custom Gradle setup:
// https://kotlin.github.io/dataframe/setupcustomgradle.html
implementation 'org.jetbrains.kotlinx:dataframe-core:%dataFrameVersion%'
implementation 'org.jetbrains.kotlinx:dataframe-json:%dataFrameVersion%'
implementation 'org.jetbrains.kotlinx:dataframe-csv:%dataFrameVersion%'
// You can add any additional IO modules you like, except for 'dataframe-arrow'.
// Apache Arrow is not supported well on Android.
}
android {
defaultConfig {
minSdk 21
}
// Requires Java 8 or higher
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
kotlinOptions.jvmTarget = "1.8"
}
This setup adds the Kotlin DataFrame core as well as a subset of the IO modules (excluding experimental ones). For flexible configuration, see Custom configuration.
Kotlin DataFrame Compiler Plugin
Kotlin DataFrame Compiler Plugin enables automatic generation of extension properties and updates data schemas on-the-fly in Android projects, making development with Kotlin DataFrame faster, more convenient, and fully type- and name-safe.
Requires Kotlin 2.2.20-Beta1 or higher.
{ style = "note" }
To enable the plugin in your Gradle project, add it to the plugins section:
plugins {
kotlin("plugin.dataframe") version "%compilerPluginKotlinVersion%"
}
plugins {
id 'org.jetbrains.kotlin.plugin.dataframe' version '%compilerPluginKotlinVersion%'
}
Due to this issue, incremental compilation must be disabled for now.
Add the following line to your gradle.properties file:
kotlin.incremental=false
Next Steps
- Once Kotlin DataFrame is set up in your Android project, continue with the to learn the basics of working with DataFrames.
- Explore detailed guides and real-world examples to see how Kotlin DataFrame helps in different data tasks.
- Check out the Android project example and more IDEA examples on GitHub.
- Learn more about the compiler plugin.