Integrate Your App with the Samsung Ads SDK
Before you begin using the Samsung Ads SDK, you must integrate your app. Do the following:
- Configure your app.
- Add dependencies to your project.
- Configure ProGuard.
Configure your app
Include the following in the top-level build.gradle
file:
allprojects {
repositories {
flatDir {
dirs 'libs'
}
}
}
Add dependencies
Add the following to the dependencies section of your application module in your build.gradle
file for the Samsung Ads SDK, Google Play services ads (required when the app is downloaded and not running in the cloud gaming environment), Gson, view binding, and other dependencies:
compile(name: 'smas-x.x.x-release.aar', ext:'aar')
implementation 'com.google.android.gms:play-services-ads:16.0.0'
implementation 'com.google.code.gson:gson:2.9.0'
implementation 'androidx.appcompat:appcompat:1.4.2'
implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.2'
buildFeatures {
viewBinding = true
}
NoteUse version 16.0.0 or earlier for Google Play services ads. Versions later than 16.0.0 require the AdMob application ID to be added in the AndroidManifest.xml file, which is not relevant to the Samsung Ads SDK.
Google Play services ads are required when the app is downloaded but is not required when running in the cloud gaming environment.
Google Play services ads are required when the app is downloaded but is not required when running in the cloud gaming environment.
Configure ProGuard
To prevent the obfuscation of the API classes of the Samsung Ads SDK, you must add the following line to your project’s ProGuard configuration file:
-keep class com.samsung.android.iaa.** { *; }
-dontwarn com.google.android.**