1.1 导入库

SDK demo

上面是SDK的demo,可以下载下来做参照对比,不懂的地方可以按demo来参考

SDK版本要求:

targetSdkVersion为30

minSdkVersion为21

引入依赖

根据游戏需要,以下两种方式可选其一

一、远程依赖

repositories {
    maven {
        // r2 SDK 开放仓库:正式
        url 'https://mvn.r2g.com.cn/repository/maven-releases/'
    }
    
    maven {
        // r2 SDK 开放仓库:快照
        url 'https://mvn.r2g.com.cn/repository/maven-snapshots/'
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
    
    implementation 'androidx.multidex:multidex:2.0.1'
    // 运营 SDK:建议使用最新版本,可通过浏览仓库地址或向运营咨询版本
    implementation "com.r2games.sdk:rncoresdk:7.2.2"

}

二、手动导入aar(请联系运营同学获取最新SDK)

1.添加SDK必须的依赖库

打开游戏应用模块的 build.gradle 文件,向 dependencies 块中添加如下新代码:

dependencies {
    implementation fileTree(include: ['*.jar','*.aar'], dir: 'libs')
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.appcompat:appcompat:1.0.0'

    implementation 'androidx.multidex:multidex:2.0.1'
    implementation 'androidx.browser:browser:1.0.0'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'androidx.recyclerview:recyclerview:1.0.0'
    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    //美团分包
    implementation 'com.meituan.android.walle:library:1.1.7'
    // AIHelp
    implementation 'net.aihelp:android-aihelp-aar:4.1.6'
     //数数SDK
    implementation 'cn.thinkingdata.android:ThinkingAnalyticsSDK:2.7.6.1'
    
}

2. 添加R2国内SDK核心AAR库

添加R2 SDK核心AAR包: r2_cn_7.0.1.aar到游戏应用自身模块中,请按照如下步骤操作:

a.选择 r2_cn_7.0.1.aar 文件,然后添加到libs文件夹下。

d.添加完后,务必进行 clean和Sync Project with Gradle Files。

Last updated

Was this helpful?