{"action":"created","issue":{"url":"https://api.github.com/repos/Kotlin/kotlinx.serialization/issues/229","repository_url":"https://api.github.com/repos/Kotlin/kotlinx.serialization","labels_url":"https://api.github.com/repos/Kotlin/kotlinx.serialization/issues/229/labels{/name}","comments_url":"https://api.github.com/repos/Kotlin/kotlinx.serialization/issues/229/comments","events_url":"https://api.github.com/repos/Kotlin/kotlinx.serialization/issues/229/events","html_url":"https://github.com/Kotlin/kotlinx.serialization/issues/229","id":366114297,"node_id":"MDU6SXNzdWUzNjYxMTQyOTc=","number":229,"title":"Kotlin 1.3-RC-116/0.8.1-rc13: Example code crashes with SerializationException: Can't locate serializer for class Data","user":{"login":"SebastianAigner","id":2178959,"node_id":"MDQ6VXNlcjIxNzg5NTk=","avatar_url":"https://avatars1.githubusercontent.com/u/2178959?v=4","gravatar_id":"","url":"https://api.github.com/users/SebastianAigner","html_url":"https://github.com/SebastianAigner","followers_url":"https://api.github.com/users/SebastianAigner/followers","following_url":"https://api.github.com/users/SebastianAigner/following{/other_user}","gists_url":"https://api.github.com/users/SebastianAigner/gists{/gist_id}","starred_url":"https://api.github.com/users/SebastianAigner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SebastianAigner/subscriptions","organizations_url":"https://api.github.com/users/SebastianAigner/orgs","repos_url":"https://api.github.com/users/SebastianAigner/repos","events_url":"https://api.github.com/users/SebastianAigner/events{/privacy}","received_events_url":"https://api.github.com/users/SebastianAigner/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-10-02T23:10:16Z","updated_at":"2018-10-04T15:14:10Z","closed_at":null,"author_association":"NONE","body":"Hello, I have spent the last two hours trying to figure out how to get even the basic example serialization with version `0.8.1-rc13` to work with Kotlin `1.3.0-rc-116`.\r\n\r\nI initially ran into an issue (`kotlin.jvm.KotlinReflectionNotSupportedError: Kotlin reflection implementation is not found at runtime. Make sure you have kotlin-reflect.jar in the classpath`) by adding `implementation \"org.jetbrains.kotlin:kotlin-reflect:$kotlin_version\"` to my `build.gradle` (as per [this SO post](https://stackoverflow.com/a/36440329/4425952)).\r\n\r\nI have also configured IntelliJ to delegate IDE build/run actions to Gradle as is required by the [EAP13 document](https://github.com/Kotlin/kotlinx.serialization/blob/master/docs/eap13.md#intellij-ideaandroid-studio).\r\n\r\nHowever, when trying to run my main method with the example code from the [README](https://github.com/Kotlin/kotlinx.serialization#quick-example), I always get\r\n\r\n```kotlin\r\nException in thread \"main\" kotlinx.serialization.SerializationException: Can't locate serializer for class Data\r\n\tat kotlinx.serialization.PlatformUtilsKt.serializer(PlatformUtils.kt:23)\r\n\tat MainKt.main(Main.kt:12)\r\n```\r\n\r\nMy main method (taken verbatim from the README):\r\n\r\n```kotlin\r\nimport kotlinx.serialization.*\r\nimport kotlinx.serialization.json.JSON\r\n\r\n@Serializable\r\ndata class Data(val a: Int)\r\n\r\nfun main(args: Array<String>) {\r\n    println(JSON.stringify(Data(42))) // {\"a\": 42, \"b\": \"42\"}\r\n    val obj = JSON.parse<Data>(\"\"\"{\"a\":42}\"\"\") // Data(a=42, b=\"42\")\r\n}\r\n```\r\n\r\nMy build.gradle, glued together using the instructions in the [EAP13 document](https://github.com/Kotlin/kotlinx.serialization/blob/master/docs/eap13.md#intellij-ideaandroid-studio):\r\n\r\n```groovy\r\nbuildscript {\r\n    ext.kotlin_version = '1.3.0-rc-116'\r\n\r\n    // no need in kotlinx repository\r\n    repositories {\r\n        jcenter()\r\n        maven { url \"https://dl.bintray.com/kotlin/kotlin-eap\" } // while you are on 1.3-RC\r\n    }\r\n\r\n\r\n    dependencies {\r\n        classpath \"org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version\"\r\n        // kotlin package, and no \"gradle-plugin\" in name\r\n        // version matches Kotlin version\r\n        classpath \"org.jetbrains.kotlin:kotlin-serialization:$kotlin_version\"\r\n    }\r\n}\r\n\r\napply plugin: 'kotlin' // or 'kotlin-platform-***' or 'kotlin-multiplatform'\r\napply plugin: 'kotlinx-serialization'\r\n\r\ngroup 'io.sebi'\r\nversion '1.0-SNAPSHOT'\r\n\r\nrepositories {\r\n    jcenter()\r\n    maven { url \"https://kotlin.bintray.com/kotlinx\" }\r\n    maven { url \"https://dl.bintray.com/kotlin/kotlin-eap\" }\r\n}\r\n\r\ndependencies {\r\n    implementation \"org.jetbrains.kotlin:kotlin-reflect:$kotlin_version\"\r\n    compile \"org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version\"\r\n    compile \"org.jetbrains.kotlinx:kotlinx-serialization-runtime:0.8.1-rc13\"\r\n}\r\n\r\ncompileKotlin {\r\n    kotlinOptions.jvmTarget = \"1.8\"\r\n}\r\n```\r\n\r\nI do not really know where to go from here - any support for getting started here is very much appreciated 😊"},"comment":{"url":"https://api.github.com/repos/Kotlin/kotlinx.serialization/issues/comments/427057543","html_url":"https://github.com/Kotlin/kotlinx.serialization/issues/229#issuecomment-427057543","issue_url":"https://api.github.com/repos/Kotlin/kotlinx.serialization/issues/229","id":427057543,"node_id":"MDEyOklzc3VlQ29tbWVudDQyNzA1NzU0Mw==","user":{"login":"sandwwraith","id":11777575,"node_id":"MDQ6VXNlcjExNzc3NTc1","avatar_url":"https://avatars1.githubusercontent.com/u/11777575?v=4","gravatar_id":"","url":"https://api.github.com/users/sandwwraith","html_url":"https://github.com/sandwwraith","followers_url":"https://api.github.com/users/sandwwraith/followers","following_url":"https://api.github.com/users/sandwwraith/following{/other_user}","gists_url":"https://api.github.com/users/sandwwraith/gists{/gist_id}","starred_url":"https://api.github.com/users/sandwwraith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sandwwraith/subscriptions","organizations_url":"https://api.github.com/users/sandwwraith/orgs","repos_url":"https://api.github.com/users/sandwwraith/repos","events_url":"https://api.github.com/users/sandwwraith/events{/privacy}","received_events_url":"https://api.github.com/users/sandwwraith/received_events","type":"User","site_admin":false},"created_at":"2018-10-04T15:14:10Z","updated_at":"2018-10-04T15:14:10Z","author_association":"COLLABORATOR","body":"No, that's not an expected behaviour, because IDEA should correctly launch app via gradle build without applying 'application' plugin. \r\n\r\nIn my sample, I've managed to run code from IDEA via Run icon on gutter with delegated build without any issues, so it seems like some tricky setup issue. Does `Data.serializer()` returns correct serializer or ide complains about unresolved reference? "}}
{"actor":{"display_login":"sandwwraith"}}