Hi, i'm using ktor for simple rest server on Android app. Everything works fine, but if i run proguard, then hell is unleashed and i have over 680 issues with progurad.
100% problems is resolved by:
-dontwarn io.netty.**
-dontwarn io.ktor.**
-dontwarn com.typesafe.**
But server is not responding after start so i'm assuming, that proguard rules should be different :)
Check/try this sample:
https://github.com/ktorio/ktor-samples/pull/13/files
@soywiz in android we use proguard-rules.pro file
i've tried to move this file as rules:
-keep class io.ktor.server.netty.DevelopmentEngine {*;}
-keep class kotlin.reflect.jvm.internal.** {*;}
-keep class io.ktor.samples.hello.HelloApplicationKt {*;}
-keep class kotlin.text.RegexOption {*;}
And i've over ~680 errors still, like
...
Warning: io.netty.handler.ssl.ConscryptAlpnSslEngine$BufferAdapter: can't find superclass or interface org.conscrypt.AllocatedBuffer
Warning: io.netty.handler.ssl.ConscryptAlpnSslEngine$BufferAllocatorAdapter: can't find superclass or interface org.conscrypt.BufferAllocator
...
Warning: com.typesafe.config.impl.ConfigBeanImpl: can't find referenced class java.beans.PropertyDescriptor
Warning: com.typesafe.config.impl.ConfigBeanImpl: can't find referenced class java.beans.BeanInfo
...
Warning: io.ktor.util.SSLKt: can't find referenced class sun.security.x509.X509CertInfo
Warning: io.ktor.util.SSLKt: can't find referenced class sun.security.x509.CertificateSerialNumber
...
Warning: io.netty.util.internal.logging.Log4J2LoggerFactory: can't find referenced class org.apache.logging.log4j.LogManager
Warning: io.netty.util.internal.logging.Log4J2LoggerFactory: can't find referenced class org.apache.logging.log4j.LogManager
Related to this:
https://stackoverflow.com/questions/49945584/attempting-to-run-an-embedded-ktor-http-server-on-android
I have done this example and seems to work:
https://github.com/soywiz/android-ktor-example
Let me know if it works for you
@soywiz you just close the minify, that does not really solve the problem, ^^,
Could you guide us how to config the proguard-rules.pro for ktor-android?
This worked for me. Running release apk works too.
# Ktor
-keep class io.ktor.** { *; }
-keep class kotlinx.coroutines.** { *; }
-dontwarn kotlinx.atomicfu.**
-dontwarn io.netty.**
-dontwarn com.typesafe.**
-dontwarn org.slf4j.**
This issue has been automatically marked as stale because it has not had recent activity.
Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.
Fixed in the origin issue
Most helpful comment
@soywiz you just close the minify, that does not really solve the problem, ^^,
Could you guide us how to config the proguard-rules.pro for ktor-android?