You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Usage of the library causes app to crash with Android release builds because R8 removes unused classes or methods from the Ksoup library. Specifically, Builder#onOpenTag is stripped out, causing a crash when only Builder#onCloseTag is called in the app.
Here's a simplified example of how the library is used in the app:
val handler =KsoupHtmlHandler
.Builder()
.onOpenTag { name, attributes, _ ->Logger.d { "tag opening name: $name" } }
.onCloseTag { name, _ ->Logger.d { "tag closing name: $name" } }
.build()
val parser =KsoupHtmlParser(handler)
try {
val html ="<p> Welcome to my home page. </p>"
parser.write(html)
} finally {
parser.end()
}
Adding the following ProGuard rule resolves the issue:
-keep class com.mohamedrejeb.ksoup.html.parser.KsoupHtmlHandler.Builder**, * { *; }
Ideally, this rule could be shipped with the library to avoid manual configuration by consumers?
I'm unsure of the best way forward, but I believe this issue warrants further investigation.
P.S. Thanks for the library, saved me a ton of time parsing html tags in a KMM project
The text was updated successfully, but these errors were encountered:
Are we using reflection? If not, this should not be stripped and if so is a bug with R8. Adding that proguard rule does not seem right, since onOpenTag should be stripped out if no one is using it!
Usage of the library causes app to crash with Android release builds because
R8
removes unused classes or methods from the Ksoup library. Specifically,Builder#onOpenTag
is stripped out, causing a crash when onlyBuilder#onCloseTag
is called in the app.Here's a simplified example of how the library is used in the app:
Adding the following ProGuard rule resolves the issue:
Ideally, this rule could be shipped with the library to avoid manual configuration by consumers?
I'm unsure of the best way forward, but I believe this issue warrants further investigation.
P.S. Thanks for the library, saved me a ton of time parsing html tags in a KMM project
The text was updated successfully, but these errors were encountered: