Developer Console

Amazon Appstore Easy Port

Apps that are built for Android OS might contain SDKs that are incompatible with Fire OS. Amazon Appstore Easy Port helps you handle compatibility issues by building your app with an equivalent SDK, which is compatible with Fire OS, at the bytecode level, minimizing the need for code refactoring. If you build your Java- or Kotlin-based Android app with the Android Gradle plugin (AGP) version 7.4.0 or higher, and use an SDK supported by Easy Port, you can use Easy Port to port your app. The following table shows the current SDKs supported by Amazon Appstore Easy Port.

SDKs supported by Amazon Appstore Easy Port
SDK category SDK supported by Easy Port
Only the version listed is supported
SDK compatible with Fire OS
Equivalent SDK used in Easy Port
Payments Google Play Billing Library version 5.2.1 for Java and Kotlin Appstore Billing Compatibility SDK version 4.1.0

Build an Android app with Amazon Appstore Easy Port

The following image shows a simplified representation of the Android app compilation process.

See text description.
Android app build process with AGP and Amazon Appstore Easy Port

To build with Amazon Appstore Easy Port, you must integrate your project with the Easy Port Gradle plugin and the Easy Port aspect files. The plugin's primary function is to integrate with the AGP build process and perform bytecode transformation using the AspectJ compiler (AJC). Easy Port aspect files control the bytecode transformation and identify calls to SDKs that are incompatible with Fire OS in a module's codebase. The aspect files then instruct AJC to intercept those calls and perform the requested operations with an SDK compatible with Fire OS. To make sure changes in your app codebase are minimal, the Easy Port aspect files also transform requests and responses between the SDK that is incompatible with Fire OS and the SDK compatible with Fire OS.

Get started with Amazon Appstore Easy Port

The following image shows the process of integrating with Amazon Appstore Easy Port.

See text description.

The following sections describe the Easy Port Gradle plugin and the Easy Port aspects.

Amazon Appstore Easy Port Gradle plugin

The Amazon Appstore Easy Port Gradle plugin enables bytecode transformation during the Android build process with AGP. Integrate the Easy Port plugin in your project, configure the plugin, and then build your app.

Requirements

  • AGP 7.4.0 or higher (AGP 7.4.0 requires Gradle 8.0 or higher)

Apply and configure Amazon Appstore Easy Port plugin

Follow these steps to configure the Amazon Appstore Easy Port plugin.

  1. At the top of your root level settings.gradle.kts or settings.gradle file, add mavenCentral() to the repositories block under pluginManagement.

     

    Copied to clipboard.

      pluginManagement {
        repositories {
            google()
            mavenCentral()
        }
      }
    

     

    Copied to clipboard.

      pluginManagement {
        repositories {
            google()
            mavenCentral()
        }
      }
    
  2. If a module is integrated with a version of an SDK that is incompatible with Fire OS and supported by Amazon Appstore Easy Port aspects, apply the Easy Port plugin to the module, as shown in the following code.

     

    Copied to clipboard.

      plugins {
      
        id("com.amazon.device.easyport") version("1.0.0")
      
      }
    

     

    Copied to clipboard.

      plugins {
      
        id 'com.amazon.device.easyport' version '1.0.0'
      
      }
    
  3. Update the module's build.gradle.kts or build.gradle file to support a product flavor for Easy Port. The Easy Port flavor must build on top of any Google-specific flavor you might have. For details about configuring product flavors, see Configure product flavors in the Android documentation. The following code shows an example configuration.

     

    Copied to clipboard.

      android {
          ...
          flavorDimensions += "build"
          productFlavors {
              create("vanilla") {
                  dimension = "build"
              }
              create("easyPort") {
                  dimension = "build"
              }
          }
      }
    

     

    Copied to clipboard.

      android {
          ...
          flavorDimensions  "build"
          productFlavors {
              vanilla {
                  dimension 'build'
              }
              easyPort {
                  dimension 'build'
              }
          }
      }
    
  4. Add the AspectJRT dependency to the module's Gradle file, as shown in the following code.

     

    Copied to clipboard.

      easyPortImplementation("org.aspectj:aspectjrt:1.9.7")
    

     

    Copied to clipboard.

      easyPortImplementation 'org.aspectj:aspectjrt:1.9.7'
    
  5. Add the following Easy Port configuration to the module's build.gradle.kts or build.gradle file.

     

    Copied to clipboard.

      easyPort { variantFilter = listOf("easyPort")}
    

     

    Copied to clipboard.

      easyPort { variantFilter = ["easyPort"]}
    
  6. Download and apply the relevant aspects.

Build the app

After applying and configuring the Amazon Appstore Easy Port plugin and aspects, use the following steps to build your app.

  1. Select the Easy Port flavor of the module, and build your app that is compatible with Fire OS.
  2. If the build succeeds but produces warnings, address the warnings generated by tasks that start with the name AspectWeaverTask. You can look for Aspect Compilation Warnings in your build logs to get a list. These warnings can be addressed by modifying your code to be OS-agnostic, or by adding OS-specific checks to your app codebase. You can suppress these warnings by using the annotation SuppressEasyPortValidation.
  3. After all warnings are addressed or suppressed, build your app again.
  4. Test all the functionality of the built app.

Amazon Appstore Easy Port aspects

Amazon Appstore Easy Port aspects specify which APIs (incompatible with Fire OS) to intercept, and which actions to take on interception. The aspects target a specific version of an SDK incompatible with Fire OS and replace the SDK's calls with calls from a specific version of an SDK compatible with Fire OS. For detailed instructions on how to add aspects, use the following resources.

Amazon Appstore Easy Port FAQ

The following are frequently asked questions (FAQ) about Amazon Appstore Easy Port.

Q: How does Easy Port help me port my Android app to Amazon Appstore?
Amazon Appstore Easy Port helps you port your app by handling compatibility issues for you. Easy Port builds your app that uses an SDK incompatible with Fire OS, with an equivalent SDK that is compatible Fire OS, at the bytecode level. This minimizes the need for code refactoring. Easy Port currently supports porting for Google Play Billing Library.
Q: How can I integrate my Android app with Appstore Billing Compatibility SDK?
If your app currently uses Google Play Billing Library, you can use Easy Port to integrate your app with Appstore Billing Compatibility SDK. Easy Port replaces Google Play Billing Library APIs with Appstore Billing Compatibility APIs at the bytecode level. If your app does not meet the requirements for Easy Port, you can directly integrate your app with Appstore Billing Compatibility SDK. For instructions, see Appstore Billing Compatibility SDK.
Q: What is AspectJ Compiler?
Easy Port uses aspect-oriented programming to replace SDKs that are incompatible with Fire OS with SDKs that are compatible with Fire OS, and uses AspectJ Compiler (AJC) to generate bytecode with the aspects applied.
Q: Does Easy Port make changes to my source code?
Easy Port doesn't directly make changes to your source code. Easy Port provides the aspects and applies them during compile time, and generates bytecode compatible with Fire OS.
Q: Does Easy Port collect any of my data?
No, Easy Port doesn't collect any data.
Q: Do I have to make any more changes to my codebase after applying Easy Port?
When you build your project with Easy Port, it produces weaving logs that guide you to make any changes if necessary. In your build logs, you can find warning messages under AspectJ Compilation Warnings. If adding the plugin or aspect dependencies created a conflict, you might also need to update your code to resolve those conflicts.
Q: Does Easy Port work on Linux?
Easy Port works on Linux, Mac, and Windows operating systems.
Q: What versions of Google Play Billing Library does Easy Port support?
Easy Port currently supports only Google Play Billing Library version 5.2.1.
Q: Does Easy Port support any other SDKs?
Currently, Easy Port helps you port from Google Play Billing Library only.

Last updated: May 23, 2024