Skip to content

AILink plugin fails on Android (Java 17 / AGP 8) without explicit dependency on archived SDK #5

@davidsarosi92

Description

@davidsarosi92

AILink plugin fails on Android (Java 17 / AGP 8) without explicit dependency on archived SDK

Description

When integrating the ailink Flutter plugin on Android with Java 17, Gradle 8, and Android Gradle Plugin (AGP) 8.x, the app crashes at runtime with a NoClassDefFoundError unless the following dependency is added manually in the app module:

implementation("com.github.elinkthings:AILinkSDKRepositoryAndroid:1.15.03")

Without this line, the plugin attempts to reference
com.pinwang.ailinkble.AiLinkPwdUtil
from within com.elinkthings.ailinksecretlib.AiLinkBleCheckUtil.decryptBroadcast(...),
but that class is missing from the packaged APK.

Stack trace:

E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/pinwang/ailinkble/AiLinkPwdUtil;
    at com.elinkthings.ailinksecretlib.AiLinkBleCheckUtil.decryptBroadcast(AiLinkBleCheckUtil.java:212)
    at com.elinkthings.sdk.ailink.ElinkBroadDataUtils.decryptBroadcast(ElinkBroadDataUtils.kt:41)
    ...
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.pinwang.ailinkble.AiLinkPwdUtil"

Environment

Flutter 3.35.7
Java 17
Android Gradle Plugin 8.5+
Gradle 8.11.1
Android SDK 34

Kotlin DSL build scripts (build.gradle.kts)

Reproduction steps

Add ailink plugin from pub.dev
Configure project according to the README (including maven { url "https://jitpack.io" })
Run the app without any extra dependencies
Observe crash on BLE broadcast decryption (decryptBroadcast)
Add the manual dependency shown above → app works normally

Expected behavior

The plugin should declare its dependency on the AILink Android SDK (AILinkSDKRepositoryAndroid) internally so that the consuming app does not need to add it manually.

Additional notes

The JitPack repo elinkthings/AILinkSDKRepositoryAndroid is currently archived, which makes this dependency brittle.

The plugin’s build.gradle should include:

implementation "com.github.elinkthings:AILinkSDKRepositoryAndroid:1.15.03"
(or an alternative maintained SDK, if available)

iOS builds are unaffected (no equivalent Java class loading issue).

Suggested fix

Add the missing implementation line to the plugin’s Android build.gradle.

Optionally publish or vendor the required AILink SDK into a stable Maven or GitHub package (since the original repository is archived).

Would you like me to make it sound slightly more formal and ready to paste directly into GitHub (with markdown formatting for headers and code blocks)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions