diff --git a/.gitignore b/.gitignore index 89324ddefe..7d8847642a 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,9 @@ # Java class files *.class +# Kotlin build files +/.kotlin + # Generated files bin/ gen/ diff --git a/app/build.gradle b/app/build.gradle index 3c720ed98a..c3d55f4bd0 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -3,6 +3,8 @@ import java.nio.file.Files plugins { id 'com.android.application' id 'com.google.protobuf' + id 'kotlin-android' + id 'kotlin-parcelize' } tasks.withType(Test).configureEach { @@ -78,6 +80,10 @@ android { targetCompatibility = JavaVersion.VERSION_17 } + kotlinOptions { + jvmTarget = JavaVersion.VERSION_17 + } + namespace = 'nodomain.freeyourgadget.gadgetbridge' defaultConfig { @@ -223,15 +229,18 @@ dependencies { testImplementation "org.robolectric:robolectric:4.15.1" testImplementation "org.hamcrest:hamcrest-library:3.0" + implementation 'androidx.core:core-ktx:1.16.0' + implementation "org.jetbrains.kotlin:kotlin-stdlib:2.2.0" + implementation "androidx.appcompat:appcompat:1.7.1" - implementation "androidx.preference:preference:1.2.1" + implementation "androidx.preference:preference-ktx:1.2.1" implementation "androidx.cardview:cardview:1.0.0" implementation "androidx.recyclerview:recyclerview:1.4.0" implementation "androidx.legacy:legacy-support-v4:1.0.0" implementation "androidx.gridlayout:gridlayout:1.1.0" - implementation "androidx.palette:palette:1.0.0" - implementation "androidx.activity:activity:1.10.1" - implementation "androidx.fragment:fragment:1.8.8" + implementation "androidx.palette:palette-ktx:1.0.0" + implementation "androidx.activity:activity-ktx:1.10.1" + implementation "androidx.fragment:fragment-ktx:1.8.8" implementation "androidx.viewpager2:viewpager2:1.1.0" // Not latest version because of https://github.com/material-components/material-components-android/issues/3924 @@ -276,10 +285,6 @@ dependencies { // Android SDK bundles org.json, but we need an actual implementation to replace the stubs in tests testImplementation 'org.json:json:20250517' - // Fix Duplicate class build error for conflicting kotlin-stdlib versions - // does not seem to be currently needed, as it uses the latest across all transitive - //implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.0")) - // Needed for Armenian transliteration implementation 'org.ahocorasick:ahocorasick:0.6.3' } diff --git a/build.gradle b/build.gradle index 88335e1785..4317d8df90 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,7 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { + ext.kotlin_version = '2.2.0' repositories { mavenCentral() google() @@ -9,6 +10,7 @@ buildscript { } } dependencies { + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath 'com.android.tools.build:gradle:8.11.0' classpath 'com.google.protobuf:protobuf-gradle-plugin:0.9.5'