Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Build errors due to old kotlin and gradle versions #894

Merged
merged 1 commit into from
Apr 30, 2024

Conversation

amrsalah3
Copy link
Contributor

@amrsalah3 amrsalah3 commented Mar 3, 2024

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:

  1. Upgrade Kotlin versions in the project to 1.9.0
  2. Upgrade Gradle version to 6.8.3 and Android Gradle Plugin to 4.2.2 to be compatible with the Kotlin version.
  3. Upgrade kotlinx serialization library version to 1.6.2 and change the obsolete dependency name from kotlinx-serialization-runtime to kotlinx-serialization-json and change the code in JSONHelper.kt file to the new API provided by the library.
  4. 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 use kotlin-parcelize plugin for parcelization.
  5. After the migration to ViewBinding, the plugin com.diffplug.spotless and ktlint() are now working properly and they automatically modified the whole project to comply with the Kotlin linting.

@amrsalah3
Copy link
Contributor Author

@CloudyPadmal @adityastic I think the build checks here are failing due to the upgraded Kotlin version used in the project but it locally builds successfully in my Android Studio Flamingo. Can you review, please?

@mariobehling mariobehling merged commit 0c9005a into fossasia:development Apr 30, 2024
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Android Build fails with 3 errors when setting up project locally on Android Studio
2 participants