Hey Guys I am experiencing a crash in my Kotlin ap...
# ktor
a
Hey Guys I am experiencing a crash in my Kotlin application when making Ktor API calls from a library module (minify enabled). The application runs fine when the API call code is moved to the main module. More in 🧵
Error ApiCallError: Serializer for class 'T' is not found. Please ensure that class is marked as '@Serializable' and that the serialization compiler plugin is applied.
Steps Taken: 1. Verified all data classes are annotated with
@Serializable
. 2. Ensured Ktor dependencies are correctly defined in the library's
build.gradle
. 3. Tested without ProGuard, which worked fine. 4. Isolated Ktor API calls in a minimal test case within the library.
I would appreciate any insights or suggestions on resolving this issue. You can find more details in my GitHub repository: https://github.com/abhinavsuthar/ktor-proguard-issue
This error only occurs when ktor code in library module, works fine when I move the code to app module. Definitely a proguard issue.
a
Can you try to use these Proguard rules?
a
Yes, I have tried adding these rules to all proguard files with no luck
I found a solution 1. Set minify to false in your library 2. Add consumer rules (optional) 3. Publish your library to maven local 4. implement maven local library instead of as a project in you app module 5. Build app with minify enabled
👍 1