Android/Android TV Installation

Sign in or Register for Apptimize. You’ll see a welcome page that asks for the name of your app. After entering all your info, you’ll see these installation instructions again.

You have three options for installing the Android SDK:

  1. Android Studio
  2. Maven
  3. Segment or mParticle Integration Kit

Note: The Android TV SDK uses the same library as the Android SDK and has the same setup steps.

Android Studio

  1. After you’re signed in, you’ll be able to download the Apptimize Android SDK jar file. Put it in the libs directory of your Android project. For Android Studio, make sure to right click the Apptimize SDK and select “Add as Library…” so the SDK will appear in your app’s build.gradle dependencies section.


Apptimize is hosted as a Maven repository

  1. Add the appropriate repositories.

    If using POM files:


    If using Android Studio with the Maven Plugin:

    repositories {
      maven { url '' }
  2. Add the appropriate dependencies.

    If using POM files:


    If using Android Studio with the Maven Plugin:

    dependencies {
      compile 'com.apptimize:apptimize-android:3.+'

Initializing Apptimize

In both the Android Studio and Maven setup options, you will need to handle initialization of the Apptimize SDK yourself.

  1. In any files that you use Apptimize, you’ll need to add one or both of the following import statements:

    import com.apptimize.Apptimize;
    import com.apptimize.ApptimizeTest;

    They’ll look something like this when you’re done:

    import android.os.Bundle;
    import android.view.Menu;
    import com.apptimize.Apptimize;
    import com.apptimize.ApptimizeTest;
    public class ToDoActivity extends Activity {
      ArrayList<String> items;
      ArrayAdapter<String> itemsAdapter;
      ListView lvItems;
  2. Next, call Apptimize.setup() from either your Application subclass (if you have one) or all of your activities’ onCreate() methods like this:

    public class ToDoActivity extends Activity {
      protected void onCreate(Bundle savedInstanceState) {
        // Insert your App Key here
        Apptimize.setup(this, "XXXxxXXxxxXXXxxXXxxxXXXxxXXxxxX");

    Replace the placeholder with your application key, which is a 31 character key that can be found on the installation instructions while logged in or in your Admin app settings. We recommend that Apptimize.setup() be called on the main thread, or in some other manner that ensures Apptimize.setup() completes before the Application’s onCreate() method completes.

  3. Double check in your AndroidManifest.xml that you’ve requested the internet access permission:

    <manifest xmlns:android="" ...>
      <uses-permission android:name="android.permission.INTERNET" />

It should look something like this:

  1. Lastly, if you have ProGuard enabled for your app, add the following to your ProGuard configuration file. These lines help ensure that programmatic tests, the Visual Editor support for newer UI elements, and our analytics SDKs integration all work properly. We recommend you add all of them for maximum capability:

    -keep class com.apptimize.** { *; }
    -keepclassmembers class * extends com.apptimize.ApptimizeTest {
    -keep class
    -keep class$LayoutParams { *; }
    -keep class { *; }
    -keep class** { *; }
    -keep class com.crashlytics.** { *; }
    -keep class { *; }
    -keep class { *; }
    -keep class { *; }
    -keep class { *; }
    -keep class com.omniture.AppMeasurementBase { *; }
    -keep class com.adobe.adms.measurement.ADMS_Measurement { *; }
    -keep class { *; }
    -keep class { *; }
    -keep class { *; }
    -keep class com.amplitude.api.AmplitudeClient { *; }
    -keep class com.amplitude.api.Revenue { *; }

Build your app to make sure that SDK was installed correctly. Verify that the SDK is loading by running your app and checking the Android logcat for the message Apptimize: Version 2.x.x.

You’ve finished the Apptimize installation and are ready to configure your first A/B experiment!

Segment or mParticle Integration Kit

You can install our Android SDK via our Segment or mParticle Integration Kits. You might want to use this option if you’re already tracking similar data with other services as you only need to send that data to Segment or mParticle once and will show up in Apptimize and other integrations with the flip of a switch.

Learn more about our Integration Kits here!