Skip to content

Missing classes detected while running R8 / Proguard #297

@MarcelReiter

Description

@MarcelReiter

Attempting to obfuscate and shrink any android app that uses Instant results in the following errors

Missing classes detected while running R8. 
Please add the missing classes or apply additional keep rules that are generated in
.../app/build/outputs/mapping/release/missing_rules.txt.

The file mentioned contains:

-dontwarn kotlinx.serialization.KSerializer
-dontwarn kotlinx.serialization.Serializable

To Reproduce

  1. Create a new Android app.
  2. Add the following dependency: implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.4.0").
  3. Create a new class which includes a field that is of type "Instant" and use it somewhere.
  4. Attempt to obfuscate and shrink the app in release.

Minimal sample
See this github project: https://github.com/MarcelReiter/dateTimeTest
You NEED to build it in release mode.
Also i made nice small commits so it's understandable what i'm doing

Environment

  • Kotlin version: 1.8.10
  • Library version: 0.4.0
  • Kotlin platforms: Android JVM

A nearly identical issue has been created by someone else in the kotlinx.serialization github:
Kotlin/kotlinx.serialization#2392 - but it seems like it is kotlinx.datetime related

Metadata

Metadata

Assignees

Labels

usageBuild problems in client projects

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions