pluginManagement {...repositories {...// Add the following content.maven { url 'https://qapm-maven.pkg.coding.net/repository/qapm_sdk/android_release/' }}}dependencyResolutionManagement {...repositories {...// Add the following content.maven { url 'https://qapm-maven.pkg.coding.net/repository/qapm_sdk/android_release/' }}}
buildscript {...dependencies {...// Add the following contentclasspath 'com.tencent.qapmplugin:qapm-plugin:3.1'...}}
plugins {...id('qapm-plugin') // Add the plugin....}...preBuild.dependsOn(UUIDGenerator) // Generate a unique identifier for subsequent stack translation....dependencies {...// Add qapmsdk dependency.implementation 'com.tencent.qapm:qapmsdk:5.4.6-pub'...}
QAPMPluginConfig {// Optional, defaults to empty. In the class where Application is located, enter attachBaseContext to see if there is an override method. If there is no override method, this item needs to be configured. The following figure shows that this check is not necessary.// tinkerApplication = 'com/tencent/qapm/demoApplication'}
android {...// Add the following content.buildFeatures {...buildConfig true}...}
dependencies {...implementation ('com.tencent.qapm:qapmsdk:5.4.6-pub') {// Add the following content.exclude group: 'com.android.support'}...}
<!--Required for information reporting--><uses-permission android:name="android.permission.INTERNET" /><!--Required for information collection--><uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /><uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
-keep class com.tencent.qapmsdk.**{*;}# If network monitoring is needed, ensure okhttp3 is not obfuscated.-keep class okhttp3.**{*;}
// Set the mobile phone model and device ID.// Device identifier required, in the form of any string. deviceId (mandatory).// The deviceId can be used to enable an allowlist, avoiding data sampling (Except crash and startup data, the sampling rate for other data is 0.1%).QAPM.setProperty(QAPM.PropertyKeyDeviceId, "Device identifier");// The mobile phone model is required (mandatory).QAPM.setProperty(QAPM.PropertyKeyModel, "Enter mobile phone model");// Set Application (mandatory).QAPM.setProperty(QAPM.PropertyKeyAppInstance, getApplication());// Set AppKey (mandatory, used to distinguish the reporting products. The value is obtained from the Product Configuration page under Mobile Performance Monitoring, refer to the previous step).QAPM.setProperty(QAPM.PropertyKeyAppId, "YourAppKey");// Set the product version, which is used for background retrieval field (mandatory).QAPM.setProperty(QAPM.PropertyKeyAppVersion, "YourApp Version");// Set the UUID to pull the obfuscated stack's mapping (mandatory. If QAPM Symbol Table Upload plugin is used, this variable can be used directly).// If the qapmplugin plugin is used, this variable will be generated at build time, and errors can be ignored. If not used, it needs to be manually input. Please ensure the use of UUID format and that one apk corresponds to only one uuid.QAPM.setProperty(QAPM.PropertyKeySymbolId, BuildConfig.QAPM_UUID);// Set the user ID, in the form of any string, which is used for background retrieval field (mandatory).// The userId can be used to enable an allowlist, avoiding data sampling (except for crash and start, the sampling rate for other data is 0.1%).QAPM.setProperty(QAPM.PropertyKeyUserId, "123456");// Set the Log level (optional). For the production environment version, set it to QAPM.LevelOff or QAPM.LevelWarnQAPM.setProperty(QAPM.PropertyKeyLogLevel, QAPM.LevelInfo);// Set the QAPM external network reporting domain (required). Chinese Mainland: https://app.rumt-zh.com; global regions (except Chinese Mainland): https://app.rumt-sg.comQAPM.setProperty(QAPM.PropertyKeyHost,"https://app.rumt-zh.com");QAPM.setProperty(QAPM.PropertyKeyHost,"https://app.rumt-sg.com");// Enable QAPM.QAPM.beginScene(QAPM.SCENE_ALL, QAPM.ModeStable);
API Name | Parameter | Parameter Description | Notes |
public static QAPM setProperty(int key, Stringvalue) Functionality: Set QAPM parameters. | key | Required. The Key that needs to be set. | - |
| QAPM.PropertyKeyLogLevel | Optional. Enable log level. (It is recommended to use QAPM.LevelDebug for Debug versions and QAPM.LevelWarn for release versions). | |
| QAPM.PropertyNeedTranslate | Optional. Whether stack translation is needed, which by default is required. If the apk is not obfuscated, then pass in 'false'. Otherwise the frontend may display everything as 'unTranslated'. | |
public static boolean beginScene(String sceneName, int mode) Functionality: Enable monitoring. | sceneName | Required. Scene name. | Use the OR operation to enable the performance module from Definition, such as enabling Crash and Anr: beginScene(“Crash&ANR”, QAPM.ModeCrash| QAPM.ModeANR) |
| mode | Required. The feature to be enabled. | |
| QAPM.ModeStable | Optional. Enable all features (Recommended for external releases. Includes interval performance, crash, ANR, WebView page load, JsError, and network). | |
| QAPM.ModeWebView | Optional. Enable WebView page load monitoring. | |
| QAPM.ModeJsError | Optional. Enable WebView JS exception monitoring. | |
| QAPM.ModeHTTPInWeb | Optional. Enable WebView network monitoring. | |
| QAPM.ModeHTTP | Optional. Enable network monitoring. | |
public static boolean endScene(String sceneName, long mode) Functionality: End monitoring (Only effective for frame drops and interval performance collection). | sceneName | Required. The name of the scene to be turned off (Required to correspond to the beginScene). | - |
| QAPM.ModeDropFrame | Optional. Turn off frame drop monitoring. | |
| QAPM.ModeResource | Optional. Turn off interval performance monitoring. | |
java.io.FileNotFoundException, qapm.properties (No such file or directory)
.
Was this page helpful?