https://kotlinlang.org logo
#ktor
Title
# ktor
l

Lukasz Kalnik

03/05/2024, 4:28 PM
Are there official Proguard rules for Ktor?
I'm facing the following error in an app consuming my library:
Copy code
ERROR: Missing classes detected while running R8. Please add the missing classes or apply additional keep rules that are generated in /runner/work/demo-app/demo/build/outputs/mapping/release/missing_rules.txt.
ERROR: R8: Missing class org.slf4j.impl.StaticLoggerBinder (referenced from: void org.slf4j.LoggerFactory.bind() and 3 other contexts)
a

Aleksei Tirman [JB]

03/06/2024, 7:35 AM
Can you try adding the line from this answer?
You can find a Proguard sample project here.
l

Lukasz Kalnik

03/06/2024, 10:10 AM
I added
Copy code
-dontwarn org.slf4j.**
To my library's Proguard rules and also to consumer rules. However this didn't fix the problem. My library uses Ktor, and the app consuming the library doesn't build anymore with this error.
The sample project you mentioned is for backend. I have an Android library and Android application, here the Proguard rules are probably a little bit different.
I see that when I include this rule
Copy code
-dontwarn org.slf4j.**
directly into my application (which consumes the library) then there is no error. The error seems to be only when I include this rule in the library's consumer Proguard rules, somehow they are not consumed by the application. This may be a problem with my CI though.
Ok, the problem was indeed my CI somehow still reporting the original error, whereas there were some other classes (not Ktor related), which threw the errors.
Your suggestion was sufficient. Thank you for your help!
👍 1
56 Views