Skip to content

Android Preparation ​

Version Numbering ​

Adapter Version Naming

UjuAd SDK adapter versions follow the "third-party SDK version + adapter iteration version" pattern:

  • First part: The version of the adapted third-party ad network SDK. For example, in uju-csj-adapter:7.5.1.1, 7.5.1.0 indicates it's based on Pangle (CSJ) SDK version 7.5.1.0.
  • Second part: The adapter's own iteration version. For example, the trailing 1 in 7.5.1.1 means adapter iteration 1.

Always use adapters matching your third-party SDK version to avoid compatibility issues.

Development Environment Requirements ​

  • minSdkVersion: 26 (API 26, compatible with Android 8.0+)
  • Java: Java 11 or higher
  • Kotlin: Kotlin 1.8 or higher
  • Gradle: 8.0+
  • Android Studio: Latest version recommended

Note: The SDK depends on AndroidX Lifecycle components internally. Ensure your project has AndroidX enabled and the corresponding lifecycle dependencies (e.g., lifecycle-runtime-ktx, lifecycle-process).

Prerequisite: Configure Maven Repository ​

In your project root settings.gradle.kts (Kotlin DSL) or settings.gradle (Groovy DSL), ensure mavenCentral() is configured:

kotlin
// settings.gradle.kts — for Kotlin DSL projects
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral() // Required
    }
}
groovy
// settings.gradle — for Groovy DSL projects
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral() // Required
    }
}

Core Library (Required) ​

Add the following dependencies in your app-level build.gradle:

groovy
// app/build.gradle
dependencies {
    // UjuAd Core SDK (required)
    implementation("com.ujusdk:uju-ad-core:3.4.2")
    implementation("com.ujusdk:uju-ad-ext:1.3.1")
}

To improve fill rate and ECPM, it's recommended to integrate Huawei and Honor OAID libraries.

Configure Repository ​

Add Huawei and Honor Maven repositories in settings.gradle:

groovy
// settings.gradle
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        // Huawei Maven repository
        maven { url "https://developer.huawei.com/repo" }
        // Honor Maven repository
        maven { url "https://developer.hihonor.com/repo" }
    }
}
kotlin
// settings.gradle.kts
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        // Huawei Maven repository
        maven("https://developer.huawei.com/repo")
        // Honor Maven repository
        maven("https://developer.hihonor.com/repo")
    }
}

Add Dependencies ​

groovy
// app/build.gradle
dependencies {
    // Huawei OAID identifier service
    implementation("com.huawei.hms:ads-identifier:3.4.62.300")
    // Honor OAID identifier service
    implementation("com.hihonor.mcs:ads-identifier:1.0.2.301")
}

ADN Integration (Optional) ​

Developers can selectively integrate the following third-party ad networks (ADNs) and their adapters.

Pangle (CSJ) ​

Repository Configuration:

groovy
// settings.gradle
maven { url "https://artifact.bytedance.com/repository/pangle" }
kotlin
// settings.gradle.kts
maven("https://artifact.bytedance.com/repository/pangle")

Dependencies:

groovy
// app/build.gradle
dependencies {
    // Pangle SDK
    implementation("com.pangle_beta.cn:mediation-sdk:7.5.1.0")
    // Pangle adapter
    implementation("com.ujusdk:uju-csj-adapter:7.5.1.1")
}

Tencent YLH ​

groovy
// app/build.gradle
dependencies {
    // YLH SDK
    implementation("com.qq.e.union:union:4.680.1550")
    // YLH adapter
    implementation("com.ujusdk:uju-ylh-adapter:4.680.1551")
}

Baidu ​

groovy
// app/build.gradle
dependencies {
    // Baidu Ads SDK
    implementation("com.baidu:mobads:9.45.0")
    // Baidu adapter
    implementation("com.ujusdk:uju-bd-adapter:9.45.2")
}

Kuaishou ​

Kuaishou SDK must be integrated as a local AAR. Place kssdklite-ad-5.3.20.2.aar in app/libs/.

groovy
// app/build.gradle
dependencies {
    // Kuaishou SDK (local AAR)
    implementation(files("libs/kssdklite-ad-5.3.20.2.aar"))
    // Kuaishou adapter
    implementation("com.ujusdk:uju-ks-adapter:5.3.20.3")
}

OPPO ​

OPPO adapter must be integrated as a local AAR. Place uju-oppo-adapter-9.4.0.aar in app/libs/.

groovy
// app/build.gradle
dependencies {
    // OPPO adapter (local AAR)
    implementation(files("libs/uju-oppo-adapter-9.4.0.aar"))
}

Note: OPPO ads also require OPPO_APP_ID meta-data in AndroidManifest.xml. See China Ad Networks - OPPO Integration (Chinese).

VIVO ​

VIVO adapter must be integrated as a local AAR. Place uju-vivo-adapter-6.2.7.4.aar and oaid_sdk_1.0.25.aar in app/libs/.

groovy
// app/build.gradle
dependencies {
    // VIVO adapter (local AAR)
    implementation(files("libs/uju-vivo-adapter-6.2.7.4.aar"))
    // VIVO OAID SDK (local AAR)
    implementation(files("libs/oaid_sdk_1.0.25.aar"))
}

Note: VIVO ads also require VIVO_APP_ID meta-data in AndroidManifest.xml. See China Ad Networks - VIVO Integration (Chinese).

Local AAR Integration ​

If you cannot use the remote Maven repository, you can integrate the SDK via local AAR files. Download the AAR files from the Downloads page and place them in app/libs/.

Core Library ​

groovy
// app/build.gradle
dependencies {
    // Core library (local AAR, replace ${version} with actual version number)
    implementation(files("libs/uju-ad-core-${version}.aar"))
    implementation(files("libs/uju-ad-ext-${version}.aar"))
}

ADN Adapters (Local AAR) ​

groovy
// app/build.gradle
dependencies {
    // Pangle adapter (local AAR, replace ${version} with actual version number)
    implementation(files("libs/uju-csj-adapter-${version}.aar"))
    // YLH adapter
    implementation(files("libs/uju-ylh-adapter-${version}.aar"))
    // Baidu adapter
    implementation(files("libs/uju-bd-adapter-${version}.aar"))
    // Kuaishou adapter
    implementation(files("libs/uju-ks-adapter-${version}.aar"))
    // OPPO adapter
    implementation(files("libs/uju-oppo-adapter-${version}.aar"))
    // VIVO adapter
    implementation(files("libs/uju-vivo-adapter-${version}.aar"))
}

Note: When using local integration, third-party ADN SDKs must also be integrated accordingly (e.g., Pangle SDK can be fetched from remote repository, Kuaishou SDK must be local AAR).

ProGuard Configuration ​

groovy
# UjuAd SDK ProGuard rules
-keep class com.uju.** { *; }

Third-Party Ad Network Configuration ​

For third-party ad network specific configurations (permissions, ProGuard rules, etc.):

Next Steps ​

After completing the preparation, continue with: