Make it easy to use LibChecker marked libraries rules in your apps.
repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
implementation "com.github.LibChecker:LibChecker-Rules-Bundle:${latest_version}"
}Initialize SDK in Application class
class App : Application() {
override fun onCreate() {
super.onCreate()
LCRules.init(this)
// Optional: set online repo (GitHub repo as default)
LCRules.setRemoteRepo(LCRemoteRepo.GitHub)
// Optional: reserved for future rule locales
LCRules.setLocale(LCLocale.ZH)
}
}Get marked rule in a suspend context
val rule: Rule? = LCRules.getRule(libName = "libflutter.so", type = NATIVE, useRegex = false)
val activityRule: Rule? = LCRules.getRule(
libName = "androidx.compose.ui.tooling.PreviewActivity",
type = ACTIVITY,
useRegex = false
)
val regexRule: Rule? = LCRules.getRule(
libName = "libAMapSDK_MAP_v7_9_1.so",
type = NATIVE,
useRegex = true
)The SDK reads the bundled rules database through Android's SQLite APIs. It does
not require Room, AppCompat, Core KTX, or kotlinx-coroutines in host apps.
Choose the coroutine context for getRule(...) in your app.
- Remove Room, AppCompat, and Core KTX dependencies if they were added only for this package.
- Keep calling
LCRules.init(this)fromApplication.onCreate(). - Use
LCRemoteRepo.GitHub/LCRemoteRepo.GitLab. The oldGithub/Gitlabaliases still work, but are deprecated. LCRules.setLocale(...)is kept for future rule locales. It is currently a no-op because bundled rules contain one label locale.- Use
LCRules.close()instead ofcloseDb(). - Do not use the old internal database classes (
RuleDao,RuleDatabase,RuleRepository,Repositories,RuleEntity, orIAPI). Query rules only throughLCRules.getRule(...).
JitPack builds with JDK 17 and publishes the library module through
:library:publishToMavenLocal.