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.

IllegalStateException after obfuscation

See original GitHub issue

Receiving ISE on creation of RealmConfiguration on release build which got obfuscated with Dexguard. Error message:

Caused by: java.lang.IllegalStateException: Couldn't find companion object of class 'ProductEntity'.
2022-04-06 10:55:01.901 32219-32219/? E/AndroidRuntime: A common cause for this is when the `io.realm.kotlin` is not applied to the Gradle module that contains the 'ProductEntity' class.

Added these rules for RealmObject classes which didn’t help:

-keep,includedescriptorclasses class com.projectname.data.vo.**$$serializer { *; }
-keepclassmembers class com.projectname.data.vo.** { *** Companion; }
-keepclasseswithmembers class com.projectname.data.vo.** {
    kotlinx.serialization.KSerializer serializer(...);
}

Is there any additional configuration needed for it? Or is it rather general misconfiguration of Dexguard on my side? Any kind of these issues are not happening on pre-KMM version of project.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
tarasmorskyi-mediamonkscommented, Apr 8, 2022

In the end issue was not with Proguard/Dexguard. It got fixed after updating gradle plugin from 7.0.4 to 7.1.2. Cannot understand why it didn’t affect the debug build though.

0reactions
nhachichacommented, Apr 7, 2022

@tarasmorskyi-mediamonks hmm https://github.com/realm/realm-kotlin-samples/tree/main/Bookshelf checks all the boxes (uses ProGaurd, model in multiplatform module and same Proguard rules …) I wonder if you can manage to reproduce the issue using the Bookshelf as a starting base (i.e copy your model from the production app into it for instance) ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to find offending class from obfuscated error message
I have a crash in my android app, which results in the following stack trace. The app is proguarded and I have the...
Read more >
Koin MP occurs IllegalStateException in Android with R8
But when I run Android app with R8 obfuscation, the following exception occurs in Kotlin Native environment. ... Steps to reproduce the behavior:....
Read more >
Obfuscate code error - Android
I tried to obfuscate the application by using minify true in build.gradle unfortunately, I got this when ... IllegalStateException: java.lang.
Read more >
IllegalStateException: buildOutput.apkData must not be null ...
Hi guys! ... This is only happens for the build that builds apk with obfuscation. The non obfuscated builds are looking fine. Issue...
Read more >
ProGuard Manual: Troubleshooting
Unexpected observations after processing¶ ... If ProGuard is not keeping the right classes or class members, make sure you are using fully qualified...
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