pwraxe / Lets-Ktor

ktor study
0 stars 1 forks source link

kotlinx.serialization compiler plugin is not applied to the module, so this annotation would not be processed. Make sure that you've setup your buildscript correctly and re-import project. #3

Open pwraxe opened 2 years ago

pwraxe commented 2 years ago

Refer this site : https://plugins.gradle.org/plugin/org.jetbrains.kotlin.plugin.serialization


buildscript {
    repositories {
        jcenter()
        maven {    url "https://plugins.gradle.org/m2/" }        <================ add this line
    }

    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.0"
        classpath "org.jetbrains.kotlin:kotlin-serialization:1.6.0"   <============== add this line
    }
}
plugins { id "org.jetbrains.kotlin.plugin.serialization" version "1.6.0" }
apply plugin: "org.jetbrains.kotlin.plugin.serialization"

dependencies {
       implementation "io.ktor:ktor-serialization:$ktor_version"
       implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.1'
       implementation 'org.jetbrains.kotlinx:kotlinx-serialization-core:1.3.1'
}
nicolasmanurung commented 7 months ago

@pwraxe

Based from documentation https://plugins.gradle.org/plugin/org.jetbrains.kotlin.plugin.serialization/1.9.21#kotlin-usage

If you using .kts actually you can remove from top build gradle root/build.gradle.kts

plugins {
    id("com.android.application") version "8.2.0" apply false
    id("org.jetbrains.kotlin.android") version "1.9.10" apply false
//    kotlin("plugin.serialization") version "1.9.21" apply false
//    kotlin("jvm") version "1.9.21" apply false
}

on /app/build.gradle.kts

plugins {
    id("com.android.application")
    id("org.jetbrains.kotlin.android")
    id("org.jetbrains.kotlin.plugin.serialization") version "1.9.21"
}
pwraxe commented 6 months ago

Hi @nicolasmanurung

I just wanted to clarify the purpose of the problems I've posted in this issue. These are my "aha!" moments from learning Ktor around 2 years ago. They capture the challenges I faced, how I tackled them (even if it took days!), and the solutions I found. ✨

Thanks for your understanding and collaboration, Happy Coading...