question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Multiplatform(Android/iOS) project. Unresolved reference: serializer

See original GitHub issue

Unresolved reference: serializer Getting this error while compiling. here is the link to my build.gradle file. link to build.gradle Projected was created using Intelij IDEA.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
sandwwraithcommented, Nov 19, 2018

It turns out that it is impossible to mix plugins Gradle block and apply plugin Gradle clauses in case of Kotlin compiler subplugins. So you need to move serialization plugin to plugins block, like this:

──────────────────────────────────────────────
modified: app/build.gradle
──────────────────────────────────────────────
@ build.gradle:3 @
 plugins {
     id 'kotlin-multiplatform' version '1.3.0'
+    id 'kotlinx-serialization' version '1.3.0'
 }
 repositories {
     maven { url "https://kotlin.bintray.com/kotlin/kotlinx" }
@ build.gradle:15 @ repositories {
 }
 apply plugin: 'com.android.application'
 apply plugin: 'kotlin-android-extensions'
-apply plugin: 'kotlinx-serialization'

 android {
     compileSdkVersion 28
──────────────────────────────────────────────
modified: build.gradle
──────────────────────────────────────────────
@ build.gradle:10 @ buildscript {
     }
     dependencies {
         classpath 'com.android.tools.build:gradle:3.2.1'
-        classpath "org.jetbrains.kotlin:kotlin-serialization:1.3.0"

     }
 }
 repositories {
──────────────────────────────────────────────
modified: settings.gradle
──────────────────────────────────────────────
@ settings.gradle:7 @ pluginManagement {
             if (requested.id.id == "kotlin-multiplatform") {
                 useModule("org.jetbrains.kotlin:kotlin-gradle-plugin:${requested.version}")
             }
+            if (requested.id.id == "kotlinx-serialization") {
+                useModule("org.jetbrains.kotlin:kotlin-serialization:${requested.version}")
+            }
         }
     }
 }

I’ll try to update general README on this soon.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Multiplatform(Android/iOS) project. Unresolved reference
Multiplatform (Android/iOS) project. Unresolved reference: serializer. r/Kotlin - Multiplatform(Android/iOS) projectΒ ...
Read more >
android - Getting unresolved reference on @Serializable in ...
First, add library "org.jetbrains.kotlinx:kotlinx-serialization-json-jvm:1.4.1" from maven to your project(Intelli IDEA menu:Β ...
Read more >
Unresolved reference serializer() in Kotlin - YouTrack - JetBrains
Create a multiplatform Kotlin project; Add serialization in the build gradle file; IDEA marks serializer() as unresolved reference, because of receiver typeΒ ...
Read more >
Adding Ktor To Kotlin Multiplatform Mobile Results ... - ADocLib
We'll implement it in the common module using Ktor and kotlinx.serialization. Ktor Version and Engine Used (client or server and name) 1.2.2, 1.2.0,...
Read more >
[Solved]-Kotlin Multiplatform with iOS: "Use of undeclared type ...
Before that update, I start to have a new issue to build the iOS artifact regarding the Kotlin Serializer: error: compilation failed: Can't...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found