跳到主要内容

开发环境

环境配置

VGPSDK 仅支持 Android Studio。若您使用 Eclipse,请切换到 Android Studio。

Android Studio 最低版本

Android Studio 最低版本为 8.13.0。集成前请确保至少使用 2024.3.2 Patch 1 版本的 Android Studio。

构建配置

更新项目级 build.gradle:

buildscript {
repositories {
// 请确保已添加 Google Maven 仓库(若无则添加)。
google()
}

dependencies {
// 更新 sdk 5.0.x
classpath 'com.android.tools.build:gradle:8.13.0'
classpath 'com.google.gms:google-services:4.3.15'
}
}

allprojects {
repositories {
// 请确保已添加 Google Maven 仓库(若无则添加)。
google()
}
}

向项目添加 VGP 仓库

在 build.gradle 顶层,在 allprojects 内的 repositories 中添加 VGP 仓库:

allprojects {
repositories {
//..
maven {
name 'nexus-vgp'
url "https://repo.vgplay.vn/repository/maven-releases/"
credentials {
username "partner"
password "d9hP*?tt"
}
}
mavenCentral()
// tiktok sdk
maven { url 'https://jitpack.io' }
}
}

Unity NDK 版本

Unity 项目请确保使用 Unity NDK 版本 28.0.13004108 或兼容版本。该 NDK 版本为正确编译及与 VGPSDK 兼容所必需。

重要说明: 此 NDK 版本专门用于修复 Google Play 16KB 页面大小兼容问题。自 2025 年 11 月 1 日起,所有面向 Android 15+ 设备的新应用和更新均须支持 16KB 页面大小。

有关 16KB 页面大小支持的详细信息,请参阅 Android 开发者指南

依赖项

在应用级 build.gradle 中添加以下依赖:

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.google.android.material:material:1.8.0'
implementation 'androidx.core:core:1.6.10'

// Google Firebase
implementation platform('com.google.firebase:firebase-bom:34.2.0')
implementation 'com.google.firebase:firebase-messaging'
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.android.gms:play-services-auth:21.3.0'

// Facebook
implementation 'com.facebook.android:facebook-core:18.1.3'
implementation 'com.facebook.android:facebook-login:18.1.3'
implementation 'com.facebook.android:facebook-share:18.1.3'

// Retrofit
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'com.squareup.retrofit2:adapter-rxjava3:2.9.0'
implementation 'com.squareup.okhttp3:logging-interceptor:4.12.0'

// Gson body parser
implementation 'com.google.code.gson:gson:2.13.1'

// RxAndroid
implementation 'io.reactivex.rxjava3:rxandroid:3.0.2'
implementation 'io.reactivex.rxjava3:rxjava:3.1.10'

// Image
implementation 'com.github.bumptech.glide:glide:4.16.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.13.2'

// Google IAP
implementation 'com.android.billingclient:billing:7.1.1'

// Resolution scale
implementation 'com.intuit.sdp:sdp-android:1.1.1'
implementation 'com.intuit.ssp:ssp-android:1.1.1'

// Database
implementation 'androidx.room:room-runtime:2.7.1'
annotationProcessor 'androidx.room:room-compiler:2.7.1'
implementation 'androidx.room:room-rxjava3:2.7.1'

// Life cycle
implementation 'androidx.lifecycle:lifecycle-process:2.9.1'
implementation 'androidx.lifecycle:lifecycle-livedata:2.9.1'

// VGP SDK
implementation 'vn.vgpjsc:vgpsdk:5.1.6'

// Adjust
implementation 'com.adjust.sdk:adjust-android:5.5.0'
implementation 'com.google.android.gms:play-services-ads-identifier:18.3.0'
implementation 'com.adjust.sdk:adjust-android-meta-referrer:5.5.0'
implementation 'com.android.installreferrer:installreferrer:2.2'
// websocket
implementation 'org.java-websocket:Java-WebSocket:1.6.0'

// Tiktok
implementation 'com.github.tiktok:tiktok-business-android-sdk:1.3.6'
}

说明: 文档中包含的 marvenUser 和 mavenPassword 仅供配置使用。