Integrate Your App with the Samsung Ads SDK

Before you begin using the Samsung Ads SDK, you must integrate your app. Do the following:

  1. Configure your app.
  2. Add dependencies to your project.
  3. 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
}

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.**