Project Setup

Britt Mullen edited this page Dec 10, 2018 · 64 revisions

There are a few quick steps that must be taken prior to integrating AdColony ads into your application:

Step 1: Installation

Option 1: Via Gradle:

Add the following Maven configuration to your build.gradle file that contains your application's or module's 'repositories' configuration block:

 * Make sure you are configuring your project or module's 'repositories' configuration
 * block and not your buildscript's 'repositories' configuration block
repositories {
    /** The default repository for Android Studio projects */
    /** The repository required for AdColony 3.0 and above */
    maven {
      url  ""      

Add the following lines to your 'dependencies' configuration within your module's build.gradle:

dependencies {
     * Any other dependencies your module has are placed in this dependency configuration
    implementation 'androidx.appcompat:appcompat:1.0.1'
    implementation 'com.adcolony:sdk:3.3.7'
    implementation ''

Option 2: Manually:

  1. Download our SDK distribution from here.
  2. Place adcolony.jar into your project's "libs" folder.
  3. Add the following to your module's build.gradle under 'dependencies':
dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    /** Any other dependencies here */

Step 2: Edit Manifest

  1. In order to take full advantage of our ad inventory on Android Pie devices with the targetSdkVersion set to 28 or higher in your build.gradle, you should set the usesCleartextTraffic attribute in your application tag to true. This is to ensure those devices continue receiving ads with http asset URLs (Opt out of cleartext traffic mentions that cleartext support is disabled by default starting with Android Pie):
  1. Set the following permissions in your project's "AndroidManifest.xml":
    This permission is used for certain ads that allow the user to save a screenshot to their phone. Note that with this permission on devices running Android 6.0 (API 23) or higher, this permission must be requested from the user. See Requesting Permissions for more details.
  • VIBRATE (optional)
    This permission is used for certain ads that vibrate during play. This is a normal level permission, so this permission just needs to be defined in the manifest to enable this ad feature. You can do this by pasting the following lines before the <application...> tag:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> 
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> 
<uses-permission android:name="android.permission.VIBRATE" />
  1. Next, copy and paste the following activity definitions within your application tag:
<activity android:name="com.adcolony.sdk.AdColonyInterstitialActivity"

Step 3: Add Google Play Services Ads Library

In order to comply with Google's developer program policies, we need to have access to advertising classes within the Google Play Services SDK for advertising ID retrieval.

Step 4: ProGuard Configuration

Add the following to your ProGuard configuration:

# For communication with AdColony's WebView
-keepclassmembers class * { 
    @android.webkit.JavascriptInterface <methods>; 

If you are using Eclipse, please make note of this setup page for Google Play Services ProGuard information. We make protected use of Activity's Multi-Window APIs at runtime, so if your application targets below API level 24 you'll need to add the following to your configuration:

# For removing warnings due to lack of Multi-Window support

Step 5: Gather Information From Your AdColony Account

Log in to the AdColony Dashboard and create an app and desired zones on the website by following the instructions provided there (please refer to "Setting up Apps and Zones" for help). Then retrieve your app ID and your corresponding zone IDs for integration (see Showing Interstitial Ads).

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.