Solvedkotlinx.serialization kotlin Multiplatform module: build errors

I tried using kotlinx.serialization in a kotlin multiplatform project in a commons module with some small model classes looking like the following:

open class Document {
    var _id: String? = null
    var _rev: String? = null

class User : Document() {

    var username: String = ""
    var email: String = ""
    var rollen: List<UserRoles> = emptyList()

    companion object {
        val TYPE = "User"

But when building via command-line I get following errors:

Unresolved reference: kotlinx
Cannot access 'Serializable': it is internal in ''
This class does not have a constructor

Its mentioned in the description that it should work with the kotlinx-serialization-runtime-common dependency which I am using. The plugin should stay the same as far as I read.

I am using kotlin 1.2.21, but already tried 1.2.20, 1.2.10 with the same results.
Gradle 4.4.1

18 Answers

✔️Accepted Answer

I received the same error message ("Cannot access 'Serializable': it is internal in ''"), but only because I forgot the import kotlinx.serialization.*. IntelliJ did not suggest to add this import automatically, so I first assumed some configuration issue. Maybe it helps someone arrivin here via Google.

Other Answers:

I get rid of that error by import I hope it helps.

You need to apply plugin: 'kotlinx-serialization' in platform buildscript too

@fisiodes Try to add import kotlinx.serialization.* to your file

Related Issues:

kotlinx.serialization kotlin Multiplatform module: build errors
I received the same error message (Cannot access 'Serializable': it is internal in '') but ...
kotlinx.serialization Strict JSON encountered unknown key
Latest versions of both Kotlin Serialization and JakeWharton's Converter should do: ...
kotlinx.serialization how to parse JSONArray to List<CustomObject> ?
If actually want to parse a root-level array you have to create serializer for List<CustomObject> an...
json Using fifo_map
As I said before in my previous comment there is a way to do it without a change in the libraries ...
json json({}) gives null instead of empty object with GCC and -std=c++17
I had a similar problem related to dumping At least there the value json::value_t::null set in defau...
sheetjs How to simply export a Worksheet to xlsx?
There are two issues: each object is mapped to a row so if you want a row with name John and city Se...
prettier Change HTML/JSX formatting to have one attribute/prop per line
The point I am trying to make is that the vertical space matters Wasting it (too much) has negative ...
prettier [resolved] [HTML] allow corresponding option to jsxBracketSameLine
I don't think I've ever seen any markup language with the closing brackets on a separate line I'd li...
fastapi WARNING: Unsupported upgrade request.
This error is not part of the FastAPI codebase When attempting to run this (using UviCorn) it starts...
prettier Feature Request: breakBeforeElse
This feels like one of those I can't adopt prettier unless options that was mentioned in the 1.0 rel...
prettier Add option to omit semicolons in output
I use standard.js which is a popular no-configuration style guide & linter They insist on a semicolo...
editor.js JSON to back to html, How?
+1 to have something like readOnly or viewMode or even better to have toHtml() method which will all...
sheetjs Doesn't work with browserify or webpack.
I was able to get it building by adding the following to my webpack config: EDIT: please raise a new...
prettier Space after function name in declarations
This is one of the reasons I've had to step away from adopting Prettier I would be quite happy with ...
prettier Ugly line break in a template string
Maybe templates should never be wrapped because it looks ugly most of time This input looks better t...
fastapi [QUESTION] How to bridge Pydantic models with SQLAlchemy?
I just finished integrating Pydantic ORM mode into FastAPI it is released as version 0.30.0 🎉 The n...
prettier Space after function keyword in anonymous functions
+1 for space after function keyword Crockford supports this: If a function literal is anonymous ...
ponzu no go files in /home/user/go/src/
try running go get -u via copy / paste that exact command. ...
prettier Break on multiple chained calls
Could we manage chains like we manage object literals in that if they have a break within them they ...
prettier Respect paren + newline
I've made a PR that: Adds wrapping parens back to JSX Arrow functions (when the JSX is multiline): U...
fastapi [QUESTION] How to send 204 response?
Instead of returning None and instead of injecting the response just return a newly created response...
prettier Prettier 2.0 – 2.0 2020
@lydell you fogot Change the default for singleQuote to true We already have a Prettier 2.0 issue – ...
sheetjs Corrupt XLSX file after downloading
Ok Sorry for the monologue but I solved it: In the frontend when making the GET Request ...
sheetjs Change header´s title when using json_to_sheet
There's no json_to_xlsx function you probably mean json_to_sheet That being said the easiest way is ...
fastapi OpenAPI UI not working properly when using automatic swagger-ui CDN (swagger-ui-3.30.1)
Thanks for reporting it and for all the discussion here everyone! 🚀 ☕ Indeed it's a bug in Swagger ...
prettier Option to add parenthesis to multiline expressions
Just because an arrow function is multiline doesn't necessarily make it complex and call for using {...
react jsonschema form Should we move to Bootstrap v4?
IMO we should get rid of Bootstrap to be fully agnostic Maybe we can still support frameworks by cre...
fastapi [QUESTION] Is this the correct way to save an uploaded file ?
@classywhetten FastAPI has almost no custom logic related to UploadFile -- most of it is coming from...
fastapi [QUESTION] Storing object instances in the app context
@ebarlas you're 100% right Description In Flask ...
fastapi [QUESTION] aiohttp integration best practice
That is one way if you want create a new session for every request You can also use a singleton appr...
json schema spec v6 annotation: named enumerations
My first reaction was that's a cumbersome mess and then I wrote it out and now I agree with you :-) ...
sheetjs how to set the automatic width?
@cjlhll Please see my solution get maximum width from the json data set column width ...
json_serializable.dart type '_InternalLinkedHashMap<dynamic, dynamic>' is not a subtype of type 'Map<String, dynamic>' in type cast
See flutter/flutter#17417 – please add a 👍 there to encourage the flutter folks to run on it ...
fastapi logs with FastAPI and Uvicorn
Doing : is exactly what I was looking for ! Thank you dbanty. Hello Thanks for FastAPI easy to use i...
lowdb node@14.16.0 Error [ERR_REQUIRE_ESM]
I opened a PR opened here to address this issue You can test it by installing the package from PR's ...
prettier Allow inline method chaining if line length does not exceed printWidth
There are many popular patterns chaining method calls using enzyme Just to give you some context on ...
fastapi [QUESTION] Client Credentials Flow openAPI UI
I think I found the solution for others looking to implement the code - tiangolo has already enabled...
prettier Typescript cannot parse // inside of JSX
@Kuzmenkoar Until the bug is fixed I think this is the nicest workaround: I'm having a problem with ...
fastapi FastAPI 0.65.2 POST request fails with "value is not a valid dict" when using the Requests library; 0.65.1 works (with a caveat)
Can confirm this still happens! We solved it by adding a -H Content-Type: application/json to the cu...
sheetjs merge cells from Array of Arrays
You need to build up the worksheet first then add the merges to the worksheet Hi ...
normalizr An empty array of results should produce an empty entity
If you don't receive any entities of a certain type Problem If the data for an entity is an empty ar...
prettier RxJS pipe chaining get formatted on a single line
I agree with @yannickglt As a developer it's much easier to reason about an RxJS pipeline if every s...
fastapi [QUESTION] Using pydantic models for GET request query params? Currently not possible, have to use dataclasses or normal classes.
@LasseGravesen You would do it like this: Check the docs here:
Newtonsoft.Json Serialization of decimals does not respect precision
I agree that this is unexpected behaviour at the very least and imho it is also a bug For 15 the pre...
jsonschema Package version mechanism incompatible with AWS Lambda
@Julian Perhaps a blurb can be added to the docs related to deploying this library using Serverless?...
json5 Should we consolidate the human-readable JSON efforts?
The obvious choice for a file extension of course is 🤪 I'd like to write comments in my .json files...
react jsonschema form Validate onBlur?
Why was this closed? This should be kept open and a prop should be added to the <Form> so that this ...
fastapi [QUESTION] about threads issue with fastapi.
Hello Hi I have a question about the threads issue with fastapi ...
browser compat data Breaking changes: scoping the npm package and dropping Node.js 8 support (RFC for BCD 2.0)
I have now merged #7155 completing the process of renaming the package to @mdn/browser-compat-data a...
prettier [1.6] Tracking issue
I just fixed all the issues I could find running it through the fb codebase and understood what was ...