CPoC SDK
Getting Started
Setup Guide

CPoC SDK Setup

Put the .license file to your project

Place the your-license-file.license in the app module's ./src/main/assets respectively

      • your-license-file.license
  • Add MineSec Package Registry to your environment

    In your machine/ environment, set up the credential for downloading the sdk package:

    ~/.gradle/gradle.properties
    # minesec client registry
    MINESEC_REGISTRY_LOGIN=minesec-product-support
    MINESEC_REGISTRY_TOKEN={token-value}

    Please seek our customer support for the token.

    Register the maven registry in your project

    In your project, (usually) the settings.gradle or settings.gradle.kts, setup the maven registry like the following:

    settings.gradle.kts
    dependencyResolutionManagement {
        repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
        repositories {
            google()
            mavenCentral()
     
            // if you need to support Huawei devices
            maven {
                url = uri("https://developer.huawei.com/repo/")
            }
     
            // MineSec's maven registry
            maven {
                val MINESEC_REGISTRY_LOGIN: String? by settings
                val MINESEC_REGISTRY_TOKEN: String? by settings
     
                requireNotNull(MINESEC_REGISTRY_LOGIN) {
                    """
                        Please set your MineSec Github credential in `gradle.properties`.
                        On local machine,
                        ** DO NOT **
                        ** DO NOT **
                        ** DO NOT **
                        Do not put it in the project's file. (and accidentally commit and push)
                        ** DO **
                        Do set it in your machine's global (~/.gradle/gradle.properties)
                    """.trimIndent()
                }
                requireNotNull(MINESEC_REGISTRY_TOKEN)
                println("MS GPR: $MINESEC_REGISTRY_LOGIN")
     
                name = "MineSecMavenClientRegistry"
                url = uri("https://maven.pkg.github.com/theminesec/ms-registry-client")
                credentials {
                    username = MINESEC_REGISTRY_LOGIN
                    password = MINESEC_REGISTRY_TOKEN
                }
            }
        }
    }

    Add SDK dependency in app gradle

    In your app's build.gradle.kts, add the following dependency of the minesec sdk:

    app/build.gradle.kts
    dependencies {
        releaseImplementation("com.theminesec.sdk:minehades:1.10.105.12.30") {
          exclude(group = "org.bouncycastle", module = "bcprov-jdk15on")
          exclude(group = "org.bouncycastle", module = "bcpkix-jdk15on")
        }
        // for debug SDK, you can declare as debugImplementation
        debugImplementation("com.theminesec.sdk:minehades-stage:1.10.105.12.30") {
          exclude(group = "org.bouncycastle", module = "bcprov-jdk15on")
          exclude(group = "org.bouncycastle", module = "bcpkix-jdk15on")
        }
     
        // ... other deps
    }

    Note that there are 2 versions of the SDK:

    • live environment with name = "minehades", it is connected to live AMS & has a more strict security checks
    • stage environment with name = "minehades-stage", has a loosen security runtime check and connected to stage/ test environment

    You could depend the SDK with debugImplementation & releaseImplementation in your app's build.gradle

    Exclude conflicting build meta

    In the packaging option, add the following:

    app/build.gradle.kts
    android {
        // ...
        packaging {
            resources {
                // ...
     
                excludes += "/META-INF/DEPENDENCIES"
                excludes += "/META-INF/LICENSE"
                excludes += "/META-INF/LICENSE.txt"
                excludes += "/META-INF/license.txt"
                excludes += "/META-INF/NOTICE"
                excludes += "/META-INF/NOTICE.txt"
                excludes += "/META-INF/notice.txt"
                excludes += "/META-INF/ASL2.0"
                excludes += "/META-INF/*.kotlin_module"
            }
        }
    }