感谢您的访问。此页面目前仅提供英语版本。我们正在开发中文版本。谢谢您的理解。

JCenter Support

Integrating and updating the Amazon Mobile Ads API in Android Studio just got easier with the API release on JCenter. JCenter is a popular repository of build-artifacts that can be integrated directly within Google’s Android Studio and the Gradle open source build automation system. If you develop your app using Android Studio and Gradle, you can integrate the Amazon Mobile Ads API by adding just a few lines of code and set up your build.gradle file so it is always on the latest version of the SDK.

The Amazon Mobile Ads API helps monetize apps and games on Android, iOS, and Fire OS phones and tablets. The network serves highly relevant ads from Amazon and other brand advertisers in the US, Europe, and Japan.

To get started:

  1. Create an Amazon developer account.
  2. Obtain an Amazon Application Key.
  3. Insert the Mobile Ads SDK into the dependencies section – add the single line of code at the end of the code snippet below into your app build.gradle file to download and integrate the Amazon Mobile Ads API.
    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        testCompile 'junit:junit:4.12'
        compile 'com.android.support:appcompat-v7:23.1.1'
        compile 'com.android.support:design:23.1.1'
        compile 'com.amazon.android:mobile-ads:5.+'
     }
    

    Note: the example above shows how to get the latest mobile ads SDK with Major version 5. You can define specific versions and/or wildcards. While using wildcards is not recommended for a live project due to unforeseen stability issues, using wildcards in your version declaration can be useful in debugging or testing the latest version of the Amazon Mobile Ads SDK. Simply replace any segment of the version number with a + to acquire the latest iteration:

    // Pull and compile latest 5.x release of the Amazon Mobile Ads SDK
    compile 'com.amazon.android:mobile-ads:5.+'
    
    // Pull and compile the latest release of the Amazon Mobile Ads SDK
    compile 'com.amazon.android:mobile-ads:+'
    

    The next time you build your application, the necessary files are acquired, and can be imported into your project the same way you used to. Please refer to the Gradle documentation to learn more about Gradle syntax.

  4. Android Studio supports a number of repositories including JCenter, Maven Central, or Ivy. While JCenter should already be properly defined, make sure your project’s top-level build.gradle has the JCenter repository defined:
    buildscript {
      repositories {
          jcenter()
      }
      dependencies {
          ...
      }
    }
    
    allprojects {
          repositories {
              jcenter()
          }
    }
    
  5. Set your Amazon Application Key in your code. The Application Key below is a sample.

    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        AdRegistration.setAppKey("0123456789ABCDEF0123456789ABCDEF");
    }
    
  6. If you already have an older version of the Amazon Mobile Ads API in your code, make sure to remove the old API.
  7. Submit your app to the Google Play and Amazon Appstore.
  8. Track your earnings on the Amazon Mobile Ad Network Performance Reports.

To learn more, go to the JCenter website.