Integrate and configure SDK
SDK information
SDK name | Version number | md5 | Package name |
APM crash SDK | Latest version: apm-crash:2.0.1 | b26b2fbb9d781b73c93e4b50b4444fc0 | com.lydaas.qtsdk:apm-crash |
APM crash SDK with 16 KB static library support | Latest version: apm-crash:2.1.0 | 28d86a2252ed5b2fa776d596b09e5fe5 | com.lydaas.qtsdk:apm-crash |
APM efs SDK | Latest version: apm-efs:2.1.0 | 2b54c6db27acc24081fbd07fc6f3c86e | com.lydaas.qtsdk:apm-efs |
Gradle plugin | Latest versions: For Gradle 7.0+: apm-plugin:2.0.1 For Gradle versions below 7.0: apm-plugin:1.0.1 | 2.0.1: eae067a2283ee6c940be516a0fed0962 1.0.1: 2dcdbe7ee400ea07ef7b2dd355c0ae65 | com.lydaas.qtsdk:apm-plugin |
1. Integrate the SDK
1.1 Configure the Maven repository and Gradle plugin
Older Gradle versions
In your project's build.gradle file, add the SDK's Maven repository address to the buildscript and allprojects blocks.
Then, add the APM Gradle plugin to the dependencies block.
buildscript {
repositories {
maven { setUrl("https://repo1.maven.org/maven2/") }
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.0'
// Add the APM Gradle plugin for Gradle versions below 7.0 as needed
classpath 'com.lydaas.qtsdk:apm-plugin:1.0.1'
}
}
allprojects {
repositories {
maven { setUrl("https://repo1.maven.org/maven2/") }
google()
jcenter()
}
}In your module-level (app-level) build.gradle file, apply the plugin.
apply plugin: 'com.efs.sdk.plugin'AGP 7 and later
In your project's settings.gradle file, add the repository address.
pluginManagement {
repositories {
google {
content {
includeGroupByRegex("com\\.android.*")
includeGroupByRegex("com\\.google.*")
includeGroupByRegex("androidx.*")
}
}
mavenCentral()
gradlePluginPortal()
maven { url 'https://repo1.maven.org/maven2/' }
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven { url 'https://repo1.maven.org/maven2/' }
}
}In your module-level (app-level) build.gradle file, add the APM Gradle plugin dependency.
buildscript {
dependencies {
classpath 'com.lydaas.qtsdk:apm-plugin:2.0.1'
}
}
plugins {
alias(libs.plugins.android.application)
}
apply plugin: 'com.efs.sdk.plugin'1.2 Add component dependencies
In your app's build.gradle file, add the component library dependencies to the dependencies block.
PX series
The PX series statistical analysis SDKs require the SM version of the APM SDK. Add the following dependencies to integrate them:
dependencies {
implementation fileTree(include:['*.jar'], dir:'libs')
// Integrate the statistical analysis SDK
implementation 'com.lydaas.qtsdk:qt-px-common:1.8.6.PX'
// APM stability SDK
implementation 'com.lydaas.qtsdk:apm-crash:2.0.1'
// APM stability SDK (16 KB SO version)
// implementation 'com.lydaas.qtsdk:apm-crash:2.1.0'
// APM performance SDK
implementation 'com.lydaas.qtsdk:apm-efs:2.1.0'
}P series (deprecated)
If you are integrating the P series of statistical analysis SDKs, use the following versions of the APM SDK:
dependencies {
implementation fileTree(include:['*.jar'], dir:'libs')
// Integrate the statistical analysis SDK
implementation 'com.lydaas.qtsdk:qt-common:1.6.1.P'
// APM stability SDK
implementation 'com.lydaas.qtsdk:apm-crash:1.5.2.1.0.0.3'
// APM performance SDK
implementation 'com.lydaas.qtsdk:apm-efs:1.6.0.001.210'
}2. Configure permissions
The host app must grant the following permissions:
Permission | Purpose |
ACCESS_NETWORK_STATE | Checks the network connection type to prevent sending data during network anomalies, which saves data and battery. |
ACCESS_WIFI_STATE | Retrieves the Wi-Fi MAC address, which is used as a unique identifier for statistical analysis on devices without an IMEI, such as tablets or TV boxes. |
INTERNET | Allows the app to connect to the internet to send data required for the statistical analysis service. |
READ_PHONE_STATE (Optional) | Retrieves the device IMEI, which is used as a unique identifier for statistical analysis. |
Example permissions in AndroidManifest.xml:
<manifest ……>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<application ……>3. Configure code obfuscation
If your app uses code obfuscation, add the following rules to prevent incorrect obfuscation of the SDK, which would render it unusable.
-keep class com.umeng.** {*;}
-keep class com.uc.** { *; }
-keep class com.efs.** { *; }
-keepclassmembers class * {
public <init> (org.json.JSONObject);
}
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}The SDK uses a reflection mechanism to access resource files from your project's R.java file. Obfuscation tools like ProGuard might remove this file during the APK build process. If you encounter this issue, add the following rule:
-keep public class [your.package.name].R$*{
public static final int *;
}4. 16 KB static library support
Support for 16 KB static libraries refers to the 16 KB memory page size standard introduced in Android 15. Starting November 1, 2025, Google Play requires all new apps and updates that target Android 15 or later to support a 16 KB page size on 64-bit devices. Apps that do not comply will be rejected. The apm-crash SDK supports 16 KB static libraries in version 2.1.0 and later. Upgrade as needed.