1단계 SDK 설치하기

    1단계 SDK 설치하기


    기사 요약

    ShopLiveHandler를 반드시 등록하세요

    ShopLive.setHandler 인터페이스를 통해서 버튼의 기능을 구현할 수 있습니다. 아래 Handler 등록하기 가이드를 참고하세요.

    Library 선택

    app/build.gradle 에 의존성을 추가하세요. 분할된 library 를 사용하세요 — 통합된 library 는 1.7.4 이후 지원종료입니다.

    통합된 library (1.7.4 이후버전 지원종료)

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

    분할된 library

    // 1) 저장소 추가 — Shoplive SDK 는 mavenCentral 배포를 종료했습니다.
    //    settings.gradle 의 dependencyResolutionManagement.repositories 또는
    //    프로젝트 build.gradle 의 repositories 에 선언하세요.
    maven {
        url = uri("https://sdk.shoplive.cloud/maven-repo")
    }
    
    // 2) 의존성 추가 — 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"
    
        // POM 에 전이 의존성이 없으므로 필요한 아티팩트를 각각 선언하세요.
        implementation "cloud.shoplive:shoplive-common:$shoplive_sdk_version" // must required
        implementation "cloud.shoplive:shoplive-network:$shoplive_sdk_version" // must required
    
        // 플레이어 백엔드는 exoplayer / media3 중 하나만 선언하세요. 둘 다 선언하면 안 됩니다.
        implementation "cloud.shoplive:shoplive-exoplayer:$shoplive_exoplayer_version"
        // Exoplayer 는 곧 deprecated 됩니다.
        // 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 등록하기

    Shoplive Android SDK로부터 여러 이벤트를 수신할 Handler를 등록하세요.

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


    Proguard Rule 추가

    R8 Build를 하면 난독화 문제가 발생할 수 있습니다. 아래의 내용을 추가해주세요.

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