Skip to main content
SDK Version Selection

Choose your SDK version below:

  • Apptrove SDK → Recommended for all projects (Latest: v2.x.x)
  • Trackier SDK → Will be deprecated in August 2026 (Latest legacy: v1.x.xx)

Use the tabs below for SDK-specific snippets.

Cordova SDK FAQ

This FAQ addresses common issues encountered when integrating the Apptrove SDK into Cordova applications, focusing on Android compatibility, build errors, and Cordova-specific problems.


Android Compatibility Issues

Q: Why does my Cordova app crash on Android 7 due to GMS (Google Mobile Services)?

A: The app crashes on Android 7 devices with the following error:

Caused by java.lang.NoClassDefFoundError: Failed resolution of: Ljava/time/Duration;
at com.google.android.gms.ads.identifier.zzd.<clinit>(zzd.java)
at com.google.android.gms.ads.identifier.zzd.zza(zzd.java)
at com.google.android.gms.ads.identifier.AdvertisingIdClient.getAdvertisingIdInfo(AdvertisingIdClient.java)
at java.lang.reflect.Method.invoke(Method.java)
at com.trackier.sdk.DeviceInfo$Companion.getGAID(DeviceInfo.java)
at com.trackier.sdk.AppTroveSDKInstance.initGaid(SourceFile)
at com.trackier.sdk.AppTroveSDKInstance.access$initGaid(SourceFile)
at com.trackier.sdk.AppTroveSDKInstance$initialize$1.invokeSuspend(AppTroveSDKInstance.java)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(BaseContinuationImpl.java)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.java:1)
at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.java:1)
at kotlinx.coroutines.scheduling.TaskImpl.run(TaskImpl.java:1)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.java:1)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.java:1)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.java:1)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.java:1)

Cause: This error occurs because Android 7 (API level 24) doesn't natively support the java.time.Duration class, which was introduced in Android 8 (API level 26). The Google Mobile Services (GMS) library tries to use this class, causing a NoClassDefFoundError.

Solution: Add the following dependency to your platforms/android/app/build.gradle file:

android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
// Add this dependency:
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.4'
}
}

dependencies {
// Add this dependency:
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.4'
}

Explanation: The coreLibraryDesugaring dependency provides backported versions of Java 8+ APIs (including java.time.Duration) for older Android versions, allowing the GMS library to work properly on Android 7 devices.


Q: Why does my Cordova app fail to build with "Inconsistent JVM-target compatibility" error?

A: The build fails with the following error:

Execution failed for task ':ApptroveLabs/cordova_sdk:compileDebugKotlin'.
> Inconsistent JVM-target compatibility detected for tasks 'compileDebugJavaWithJavac' (1.8) and 'compileDebugKotlin' (17).

Cause: This error occurs due to a mismatch between the Java and Kotlin JVM target versions. The compileDebugJavaWithJavac task uses Java 1.8, while the compileDebugKotlin task targets JVM 17.

Solution: Update the Android build.gradle file to align the Java and Kotlin JVM targets to version 17:

android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

kotlin {
jvmToolchain(17)
}
}

Q: Why do install and event features stop working in Cordova release builds?

A: When switching from debug to release builds with minifyEnabled and shrinkResources enabled, the SDK's install and event tracking features stop functioning.

Cause: ProGuard or R8 optimizations in release builds may strip or obfuscate classes required by the SDK, particularly those related to Kotlin reflection or metadata.

Solution: Add the following ProGuard rules to your platforms/android/app/proguard-rules.pro file:

-keep class kotlin.Metadata { *; }
-keep class kotlin.reflect.jvm.internal.** { *; }
-keep class com.apptrove.sdk.** { *; }
-keep class com.trackier.sdk.** { *; }
-dontwarn kotlin.**
-dontwarn com.apptrove.sdk.**
-dontwarn com.trackier.sdk.**

Cordova Specific Issues

Q: How do I properly install the Cordova SDK?

A: Install the SDK using npm:

# Install the Apptrove Cordova SDK
npm install ApptroveLabs/cordova_sdk#ApptroveSDK

For Ionic Native apps, additional steps are required:

# Install Awesome Cordova Plugins core
npm install @awesome-cordova-plugins/core --save

# Sync Capacitor dependencies
ionic cap sync

# No manual plugin folder copy is required
# Use imports from: com.apptrove.cordova_sdk/ionic-native/apptrove/ngx

Important: Make sure you have the latest version of Cordova CLI installed.


Q: How do I initialize the SDK in Cordova?

A: Initialize the SDK in your JavaScript code:

For Pure Cordova:

document.addEventListener('deviceready', onDeviceReady, false);

function onDeviceReady() {
var key = "0455721b-XXXX-XXXXX-596d818d910a"; // Replace with your SDK key
var appTroveConfig = new AppTroveConfig(key, AppTroveEnvironment.Development);
AppTroveCordovaPlugin.initializeSDK(appTroveConfig);
}

For Ionic Native:

import { Component } from '@angular/core';
import { AppTroveCordovaPlugin, AppTroveConfig, AppTroveEnvironment } from 'com.apptrove.cordova_sdk/ionic-native/apptrove/ngx';

@Component({
selector: 'app-tab1',
templateUrl: 'tab1.page.html',
styleUrls: ['tab1.page.scss']
})
export class Tab1Page {
constructor(private apptroveCordovaPlugin: AppTroveCordovaPlugin) {}

async ngOnInit() {
var key = "0455721b-XXXX-XXXXX-596d818d910a"; // Replace with your SDK key
var appTroveConfig = new AppTroveConfig(key, AppTroveEnvironment.Development);
this.apptroveCordovaPlugin.initializeSDK(appTroveConfig);
}
}

Important: Always initialize the SDK after the deviceready event is fired.


Q: Why are my events not being tracked in Cordova?

A: Common causes and solutions:

  1. SDK not initialized: Ensure the SDK is initialized after deviceready
  2. Network permissions: Add internet permission to platforms/android/app/src/main/AndroidManifest.xml:
    <uses-permission android:name="android.permission.INTERNET" />
  3. ProGuard rules: Add ProGuard rules for release builds (see above)
  4. Wrong environment: Make sure you're using the correct environment setting
  5. Plugin not installed: Verify the SDK is properly installed

Q: How do I track custom events in Cordova?

A: Use the TrackierEvent class:

For Pure Cordova:

// Track a custom event
var appTroveEvent = new AppTroveEvent("1CFfUn3xEY"); // Event ID from dashboard
appTroveEvent.setParam1("Param 1");
appTroveEvent.setParam2("Param 2");
appTroveEvent.setCouponCode("TestCode");
AppTroveCordovaPlugin.trackEvent(appTroveEvent);

For Ionic Native:

// Track a custom event
var appTroveEvent = new AppTroveEvent("1CFfUn3xEY"); // Event ID from dashboard
appTroveEvent.setParam1("Param 1");
appTroveEvent.setParam2("Param 2");
appTroveEvent.setCouponCode("TestCode");
this.apptroveCordovaPlugin.trackEvent(appTroveEvent);

Q: How do I track revenue events in Cordova?

A: Use the revenue and currency methods:

// Track revenue event
var appTroveEvent = new AppTroveEvent("1CFfUn3xEY");
appTroveEvent.setParam1("Param 1");
appTroveEvent.setRevenue(10.0); // Revenue amount
appTroveEvent.setCurrency("INR"); // Currency code
AppTroveCordovaPlugin.trackEvent(appTroveEvent);

Q: How do I pass user data to the SDK?

A: Use the user data methods:

// Set user data
AppTroveCordovaPlugin.setUserId("TestUserId");
AppTroveCordovaPlugin.setUserName("Test");
AppTroveCordovaPlugin.setUserPhone("8130XXX721");
AppTroveCordovaPlugin.setUserEmail("abc@gmail.com");
AppTroveCordovaPlugin.setDOB("1990-01-01"); // YYYY-MM-DD
AppTroveCordovaPlugin.setGender("Male");

// Then track event
var appTroveEvent = new AppTroveEvent("1CFfUn3xEY");
AppTroveCordovaPlugin.trackEvent(appTroveEvent);

Q: Why does my Cordova app crash on Android startup?

A: Common causes and solutions:

  1. Missing permissions: Ensure all required permissions are in AndroidManifest.xml
  2. ProGuard issues: Add ProGuard rules for release builds
  3. SDK not installed: Verify the SDK is properly added to the project
  4. SDK not initialized: Make sure SDK is initialized after deviceready

Solution: Add these permissions to platforms/android/app/src/main/AndroidManifest.xml:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="com.google.android.gms.permission.AD_ID" />

Build and Configuration Issues

Q: How do I configure ProGuard for Cordova release builds?

A: Add the following rules to platforms/android/app/proguard-rules.pro:

# AppTrove SDK ProGuard rules
-keep class kotlin.Metadata { *; }
-keep class kotlin.reflect.jvm.internal.** { *; }
-keep class com.trackier.sdk.** { *; }
-dontwarn kotlin.**
-dontwarn com.trackier.sdk.**

# Cordova specific
-keep class org.apache.cordova.** { *; }
-keep class org.apache.cordova.engine.** { *; }

Q: Why does my app size increase significantly after adding the Trackier SDK?

A: The SDK includes dependencies that contribute to APK size. To minimize the increase:

  1. Enable R8 optimization in platforms/android/app/build.gradle:

    android {
    buildTypes {
    release {
    minifyEnabled true
    shrinkResources true
    }
    }
    }
  2. Add ProGuard rules (see above) to remove unused code

  3. Use APK Analyzer in Android Studio to identify large dependencies


Q: How do I handle deep linking in Cordova with Trackier SDK?

A: Configure deep linking in your Cordova app:

  1. Add URL scheme to platforms/android/app/src/main/AndroidManifest.xml:

    <activity>
    <intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data android:scheme="yourapp" />
    </intent-filter>
    </activity>
  2. Initialize deep link listener in your Cordova JavaScript code:

For Pure Cordova:

document.addEventListener('deviceready', function() {
// Initialize deep link listener
var observable = AppTroveCordovaPlugin.setDeferredDeeplinkCallbackListener();
observable.subscribe(function(deepLinkUrl) {
console.log('User installed via deeplink:', deepLinkUrl);
// Handle navigation here
});
}, false);

For Ionic Native:

import { Component } from '@angular/core';
import { AppTroveCordovaPlugin } from 'com.apptrove.cordova_sdk/ionic-native/apptrove/ngx';

@Component({
selector: 'app-tab1',
templateUrl: 'tab1.page.html',
styleUrls: ['tab1.page.scss']
})
export class Tab1Page {
constructor(private apptroveCordovaPlugin: AppTroveCordovaPlugin) {}

async ngOnInit() {
// Initialize deep link listener
const observable = this.apptroveCordovaPlugin.setDeferredDeeplinkCallbackListener();
observable.subscribe((deepLinkUrl: string) => {
console.log('User installed via deeplink:', deepLinkUrl);
// Handle navigation here
});
}
}
  1. Send immediate deep links :
// Handle immediate deep links
document.addEventListener('deviceready', function() {
window.handleOpenURL = function(url) {
AppTroveCordovaPlugin.parseDeepLink(url);
};
}, false);

Ionic Native Specific Issues

Q: How do I register the TrackierCordovaPlugin provider for Ionic Native?

A: Add the provider to your app.module.ts:

import { NgModule } from '@angular/core';
import { AppTroveCordovaPlugin } from 'com.apptrove.cordova_sdk/ionic-native/apptrove/ngx';

@NgModule({
declarations: [AppComponent],
imports: [BrowserModule, IonicModule.forRoot(), AppRoutingModule],
providers: [AppTroveCordovaPlugin, { provide: RouteReuseStrategy, useClass: IonicRouteStrategy }],
bootstrap: [AppComponent]
})
export class AppModule {}

Q: Why is the TrackierCordovaPlugin not found in Ionic Native?

A: Common causes:

  1. Plugin not installed: Verify the SDK package is installed in node_modules.
  2. Capacitor not synced: Run ionic cap sync after installation.
  3. Import path mismatch: Use the import path for your SDK:
    • Apptrove SDK: com.apptrove.cordova_sdk/ionic-native/apptrove/ngx
    • Trackier SDK (legacy): @awesome-cordova-plugins/trackier/ngx
  4. Legacy Trackier setup missing: If using Trackier legacy import, verify the trackier folder exists in node_modules/@awesome-cordova-plugins/.

Solution: Follow the complete installation steps for Ionic Native apps.


Troubleshooting

Q: How do I enable debug logging in Cordova?

A: Enable debug mode during SDK initialization:

var appTroveConfig = new AppTroveConfig(key, AppTroveEnvironment.Development);
// Debug logging is automatically enabled in development environment
AppTroveCordovaPlugin.initializeSDK(appTroveConfig);

Q: How do I test the SDK in Cordova?

A: Testing steps:

  1. Use development environment for testing
  2. Enable debug logging (see above)
  3. Test on real devices (not simulators)
  4. Check network requests in debug console
  5. Verify ProGuard rules for release builds
  6. Test on both Android and iOS platforms

Q: What should I do if the SDK is not working?

A: Follow these troubleshooting steps:

  1. Check SDK installation: Verify the SDK is properly installed
  2. Check SDK initialization: Ensure SDK is initialized after deviceready
  3. Verify permissions: Check all required permissions are added
  4. Test network connectivity: Ensure app can make network requests
  5. Check ProGuard rules: Verify rules are added for release builds
  6. Enable debug logging: Check console for error messages
  7. Test on real device: Simulators may not work properly
  8. Check platform-specific issues: Test on both Android and iOS
  9. Contact support: If issues persist, contact Apptrove support

Q: How do I update the Cordova SDK?

A: Update the SDK using npm:

# Update to the latest version
npm update ApptroveLabs/cordova_sdk

# Or install from the ApptroveSDK branch
npm install ApptroveLabs/cordova_sdk#ApptroveSDK

For Ionic Native apps, also run:

ionic cap sync

Q: Why does the SDK not work on iOS?

A: Common iOS-specific issues:

  1. CocoaPods not installed: Install CocoaPods if not already installed
  2. Platform not added: Add iOS platform: cordova platform add ios
  3. Build issues: Clean and rebuild the project
  4. Permissions: Ensure iOS permissions are properly configured

Solution: Run these commands:

# Add iOS platform if not added
cordova platform add ios

# Clean and rebuild
cordova clean
cordova build ios

Support

For additional help: