Add kotlinx.serialization-json dependencies

This commit is contained in:
lynxnb 2022-07-29 17:29:11 +02:00 committed by Mark Collins
parent f52ea7bddb
commit b03f624191
3 changed files with 33 additions and 2 deletions

View File

@ -4,6 +4,7 @@ plugins {
id 'kotlin-kapt'
id 'dagger.hilt.android.plugin'
id 'idea'
id 'org.jetbrains.kotlin.plugin.serialization' version "$kotlin_version"
}
idea.module {
@ -108,7 +109,7 @@ android {
dependencies {
/* Google */
implementation "androidx.core:core-ktx:1.7.0"
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'androidx.preference:preference-ktx:1.2.0'
@ -123,7 +124,8 @@ dependencies {
implementation 'com.google.android.flexbox:flexbox:3.0.0'
/* Kotlin */
implementation("org.jetbrains.kotlin:kotlin-reflect:1.6.20")
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:$serialization_version"
/* JetBrains */
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"

View File

@ -6,3 +6,31 @@
-keep class emu.skyline.** { *; }
# Keep kotlin classes so that kotlin reflection works
-keep class kotlin.** {*;}
# https://github.com/Kotlin/kotlinx.serialization#android
# Keep `Companion` object fields of serializable classes.
# This avoids serializer lookup through `getDeclaredClasses` as done for named companion objects.
-if @kotlinx.serialization.Serializable class **
-keepclassmembers class <1> {
static <1>$Companion Companion;
}
# Keep `serializer()` on companion objects (both default and named) of serializable classes.
-if @kotlinx.serialization.Serializable class ** {
static **$* *;
}
-keepclassmembers class <2>$<3> {
kotlinx.serialization.KSerializer serializer(...);
}
# Keep `INSTANCE.serializer()` of serializable objects.
-if @kotlinx.serialization.Serializable class ** {
public static ** INSTANCE;
}
-keepclassmembers class <1> {
public static <1> INSTANCE;
kotlinx.serialization.KSerializer serializer(...);
}
# @Serializable and @Polymorphic are used at runtime for polymorphic serialization.
-keepattributes RuntimeVisibleAnnotations,AnnotationDefault

View File

@ -3,6 +3,7 @@
buildscript {
ext {
kotlin_version = '1.6.21'
serialization_version = '1.3.3'
lifecycle_version = '2.4.1'
hilt_version = '2.41'
}