Step1. Installing the SDK

    Step1. Installing the SDK


    Article summary

    You should register ShopLiveHandler

    Register the ShopLive.setHandler to implement your business logic on each button clicks. Refer to the Handler registration guide.

    Select a library

    Add the dependencies to app/build.gradle. Use the individual library components — the Integrated library is not supported after 1.7.4.

    Integrated library (not supported after 1.7.4)

    dependencies {
        def shoplive_sdk_version = "1.6.2"
        
        // Shoplive combined packaging
        implementation "cloud.shoplive:shoplive-sdk-all:$shoplive_sdk_version" // live + short-form
    }

    Individual library components

    // 1) Add the repository — Shoplive SDK is no longer published to mavenCentral.
    //    Declare it in settings.gradle (dependencyResolutionManagement.repositories)
    //    or in your project-level build.gradle repositories block.
    maven {
        url = uri("https://sdk.shoplive.cloud/maven-repo")
    }
    
    // 2) Add the dependencies — app/build.gradle
    dependencies {
        def shoplive_sdk_version = "1.8.14"
        def your_exoplayer_version = "2.19.1"
        def your_media3_version = "1.10.1"
        def shoplive_exoplayer_version = your_exoplayer_version + "." + "20"
        def shoplive_media3_version = your_media3_version + "." + "3"
    
        // These POMs carry no transitive dependencies, so declare each artifact you need.
        implementation "cloud.shoplive:shoplive-common:$shoplive_sdk_version" // must required
        implementation "cloud.shoplive:shoplive-network:$shoplive_sdk_version" // must required
    
        // shoplive-exoplayer and shoplive-media3 are alternative player backends.
        // Pick ONE of the two — do not declare both.
        implementation "cloud.shoplive:shoplive-exoplayer:$shoplive_exoplayer_version"
        // Exoplayer will be deprecated soon.
        // https://developer.android.com/guide/topics/media/media3/getting-started/migration-guide
        // implementation "cloud.shoplive:shoplive-media3:$shoplive_media3_version"
    
        implementation "cloud.shoplive:shoplive-sdk-core:$shoplive_sdk_version" // for live player
    
        implementation "cloud.shoplive:shoplive-short-form:$shoplive_sdk_version" // for short-form player
    
        implementation "cloud.shoplive:shoplive-filter:$shoplive_sdk_version" // for short-form editor
        implementation "cloud.shoplive:shoplive-video-editor:$shoplive_sdk_version" // for short-form editor
    
        implementation "cloud.shoplive:shoplive-permission:$shoplive_sdk_version" // for permission request
    }
    


    Handler

    Register a Handler to receive multiple events from the Shoplive Android SDK.

    ShopLive.setHandler(object : ShopLiveHandler() {
        override fun handleNavigation(context: Context, url: String) {
            // Do something
        }
    })


    Add Proguard Rule

    If you do an R8 Build, you may run into obfuscation issues, add the following:

    -keep public class cloud.shoplive.** { *; }
    -dontwarn cloud.shoplive.**
    -keep class org.json.** { *; }