Skip to main content

Legacy Java Support (JDK 11)

While our main Unity Billing SDK is optimized for modern environments (JDK 17+), we recognize that some projects are tied to JDK 11 due to specific build pipelines or engine constraints.

👍
JDK 11 is supported from release 3.3.0 via MavenCentral

As of release 3.3.0, JDK 11 is supported directly through MavenCentral, so manually importing AAR files is no longer required. We recommend migrating to the latest version and using the standard MavenCentral integration.

The manual AAR-based flow described below is only needed if you stay on an older release. If you keep the manual integration, make sure no old files remain under Assets/Plugins/Android and that you import the correct AAR files from the JDK 11 branch.

To support projects that remain on the manual flow, we have maintained a dedicated branch that reverts the distribution flow from MavenCentral to a manual AAR-based integration.


Prerequisites & Compatibility

Requirement

Value

Java Version

JDK 11

Distribution

Manual AAR importing + UPM Branch

Unity Versions

Unity 2022.3 LTS
Unity 2021.3 LTS
Unity 2020.3 LTS

Branch URL

https://github.com/Aptoide/aptoide-unity-billing-sdk.git#support-jdk-11


Integration Steps

Follow these steps to integrate the Aptoide Unity Billing SDK supporting JDK 11.

1. Import the SDK via UPM

Instead of the main branch, you must target the specific #support-jdk-11 tag in the Unity Package Manager.

  1. Open your Unity project.
  2. Navigate to Window > Package Manager.
  3. Click the + icon and select Add package from git URL...
  4. Paste the following URL: https://github.com/Aptoide/aptoide-unity-billing-sdk.git#support-jdk-11

2. Manual AAR Deployment

Because this version does not pull the Native SDK from MavenCentral (to maintain JDK 11 compatibility), you must move the Android binaries manually.

  1. In your Unity Project window, navigate to the Aptoide Package folder: Packages/Aptoide Unity Billing SDK/Runtime/Plugins/Android
  2. Copy all .aar files found in that directory.
  3. Paste them into your project's local folder: Assets/Plugins/Android

Note: If the Assets/Plugins/Android folder does not exist, create it manually.

3. Modify mainTemplate.gradle

To avoid version conflicts and ensure all logic is handled by the local AARs, you must adjust your Gradle configuration.

  1. Open your mainTemplate.gradle (usually located in Assets/Plugins/Android).
  2. Remove any existing implementation imports for the Aptoide Native Billing SDK.
  3. Add the manual dependencies required by the Native SDK. These are necessary because manual AARs do not "self-resolve" transitive dependencies like MavenCentral does. Ensure you include the standard AndroidX and Material libraries required for the SDK to function.

4. Configuration

Once the AARs and Gradle are set up, follow the standard Unity SDK Configuration Guide to initialize the billing client and define your products.


Troubleshooting JDK 11 Issues

  • Duplicate Class Errors: If you see "Duplicate Class" errors during build, ensure you have removed the implementation line for the Aptoide SDK from your Gradle files, as the SDK is now being provided locally by the AAR in your Plugins folder. Also, ensure that you've removed the Plugin folder from the Aptoide Unity Billing SDK folder and its .meta file.
  • Missing Dependencies: If the build fails with "Symbol not found" errors, double-check that you have manually added the necessary AndroidX and Material dependencies to your mainTemplate.gradle.