You are here: Developers > OpenX Mobile Android SDK > Importing the Android SDK

Importing the Android SDK

Last updated on October 5, 2017

You can use Gradle and Android Studio to import the SDK into your app.

  1. Extract the content from the SDK zip file.

    Extracted Android zip file

  2. Open your project in your file explorer.
  3. Android SDK importing

  4. Create a libs directory in your project if it does not already exist.

    Android SDK libs folder

  5. Copy AndroidSDK-X.X.X.aar from the extracted OpenX_Mobile_SDK_Android folder into libs.

    Android SDK copied to libs

  6. Change the project build.gradle file to include the libs directory.

    build.gradle (Project: MyApp)

    
    allprojects {
    	repositories {
    		...
    		flatDir {
    			dirs 'libs'
    		}
    	}
    }
    			

    Android SDK import to project gradle

  7. Change the module build.gradle file (not the project build.gradle file) as follows:
    1. Add 'com.google.android.gms:play-services-ads:11.2.0 (or the latest version) as a dependency.
    2. Add 'compile 'com.android.volley:volley:1.0.0' as a dependency.

    3. Add the OpenX Mobile Android SDK .aar file as a dependency.

      build.gradle (Module: app)

      
      dependencies {
      	...
      	compile 'com.google.android.gms:play-services-ads:x.x.x'
      	compile 'com.android.volley:volley:x.x.x'
      	compile(name: 'AndroidSDK-x.x.x', ext:'aar')
      }
      			

      Change module build.gradle file

  8. In Android Studio, select Tools > Android > Sync Project with Gradle files.

    The OpenX Mobile Android SDK library is now successfully added to your project.

  9. Select Build > Rebuild project. Android Studio uses the Gradle build system, which refers to the build.gradle files in each of the projects you imported.

  10. Select Run > app to launch your app integrated with OpenX Mobile Android SDK on a connected device or on an emulator.

  11. Next, see Integrating the SDK with your project.

See also

Feedback form