badgemagic-android
badgemagic-android copied to clipboard
fix: Build errors due to old kotlin and gradle versions
Fixes #893 here.
The project fails to build due to the old Kotlin version that can't use kotlinx.serialization library. Also, the library changed its dependencies declaration from the older versions. After several attempts to solve the unsupported versions and the resulting issues due to changing the versions in the project, what works eventually is the following:
Changes:
- Upgrade Kotlin versions in the project to 1.9.0
- Upgrade Gradle version to 6.8.3 and Android Gradle Plugin to 4.2.2 to be compatible with the Kotlin version.
- Upgrade kotlinx serialization library version to 1.6.2 and change the obsolete dependency name from
kotlinx-serialization-runtime
tokotlinx-serialization-json
and change the code inJSONHelper.kt
file to the new API provided by the library. - Due to the previous upgrades,
kotlin-android-extensions
plugin (which provides Kotlin synthetics and parcelization) is now unsupported because it was an experimental plugin, and it is not possible to build the project with it. Therefore, we need to migrate from Kotlin synthetics to Jetpack View Binding. In addition, we need to usekotlin-parcelize
plugin for parcelization. - After the migration to ViewBinding, the plugin
com.diffplug.spotless
andktlint()
are now working properly and they automatically modified the whole project to comply with the Kotlin linting.