Skip to content

Troubleshooting

Compilation Troubleshooting

If an error occurs during compilation, first check the compilation environment.

Runnable Compilation Environments

✅ Runnable Environment

  • AGP com.android.tools.build:gradle version 3.5.0 or later
  • Gradle version 5.4.0 or later
  • Java version 8.0 or later
  • Android minSdkVersion 21

Note: As Android Studio versions are updated, the compatibility of these versions may also change. If your compilation environment meets the above conditions but you still encounter compilation errors, contact our development team.

⚠️ Compatible Environment

  • AGP com.android.tools.build:gradle version 3.0.1 or later
  • Gradle version 4.8.1 or later
  • Java version 8.0 or later
  • Android minSdkVersion 21

In this environment, ft-plugin cannot be used. For the parts that require automatic data capture, you need to complete manual integration. For more information about manual integration, see Manual Integration.

SDK Cannot Be Resolved or Imported

The above errors occur because the Maven repository is not configured correctly. See the configuration here.

Compilation Errors

Desugaring Error

>Task :app:transformClassesWithStackFramesFixerForDebug
    Exception in thread "main" java.lang.IllegalStateException: Expected a load for Ljava/lang/String; to set up parameter 0 for com/ft/sdk/FTRUMGlobalManager$$Lambda$11 but got 95
        at com.google.common.base.Preconditions.checkState (Preconditions.java:756)
        at com.google.devtools.build. android.desugar.LambdaDesugaring$InvokedynamicRewriter .attemptAllocationBeforeArgumentLoadsLambdaDesugaring.java:535)
        at com.google.devtools.build.android.desugar.LambdaDesugaring$InvokedynamicRewriter.visitInvokeDynamicInsn
        (LambdaDesugaring.java: 420)
        at org.objectweb.asm.ClassReader.a(Unknown Source)
        at org.objectweb.asm.ClassReader.b(Unknown Source)
        at org.objectweb.asm.ClassReader.accept(Unknown Source)
        at org.objectweb.asm.ClassReader.accept(Unknown Source)
        at com.google.devtools.build. android.desugar. Desugar.desugarClassesInInput (Desugar.java:401) at com.google.devtools.build.android.desugar.Desugar.desugar0neInput(Desugar.java:326) at com.google.devtools.build.android.desugar. Desugar.desugar (Desugar.java:280) at com.google.devtools.build.android.desugar. Desugar.main (Desugar.java:584)
If the above error occurs during compilation, it is caused by an AGP 3.0.0 compatibility issue. This issue describes the problem. You can resolve it by upgrading AGP to 3.1.0 or later, or by using a newer SDK version and upgrading the version in app/build.gradle.

dependencies {
    implementation('com.cloudcare.ft.mobile.sdk.tracker.agent:ft-sdk:1.3.10.beta01')// 1.3.10 or later is supported
    }

API 'android.registerTransform' is obsolete

In AGP 7.0, Transform is marked as Deprecated, and it was deprecated in AGP 8.0. ft-plugin:1.2.0 has been adapted. Upgrade to the corresponding version to fix this error. For details, see Integration Configuration.

AndroidComponentsExtension ClassNotFoundException

AndroidComponentsExtension is a method supported by AGP 7.4.2. In compilation environments earlier than this version, this error occurs. You can use the ft-plugin-legacy version to fix this error. For details, see Integration Configuration.

java.lang.IllegalArgumentException:

  • Invalid opcode 169

If this error occurs while using ft_plugin_legacy, it is a bug in asm-commons:7.0. The original issue is here. Resolve it by depending on org.ow2.asm:asm-commons:7.2 or later in the plugin configuration. You can confirm the actual asm-commons version in use with ./gradlew buildEnvironment.

buildscript {
    dependencies {
        classpath 'com.cloudcare.ft.mobile.sdk.tracker.plugin:ft-plugin-legacy:[version]'
        // Add dependency
        classpath 'org.ow2.asm:asm-commons:7.2' 
    }
}
  • org.ow2.asm:asm version earlier than 7.0

Currently, the plugin version only supports build environments using org.ow2.asm:asm7.x or later. You can check the build environment with ./gradlew buildEnvironment to confirm. You can fix this by forcing a dependency on version 7.x or later; version 7.2 or later is recommended.

buildscript {
    dependencies {
        classpath 'com.cloudcare.ft.mobile.sdk.tracker.plugin:ft-plugin-legacy:[version]'
        // Add dependency
        classpath 'org.ow2.asm:asm:7.2'
        classpath 'org.ow2.asm:asm-commons:7.2'
    }
}

SDK Initialization Exception Check

Check Logcat to confirm whether there are logs with Level set to Error and a Tag prefixed with [FT-SDK].

[FT-SDK] com.demo E 请先安装SDK(在应用启动时调用 FTSdk.install(FTSDKConfig ftSdkConfig))

Enable Debug Mode

ft-sdk Debug Mode

You can enable the SDK debug feature with the following configuration. Once enabled, the Logcat console outputs SDK debug logs. You can filter by the [FT-SDK] string to locate Guance SDK logs.

  val config = FTSDKConfig.builder(datakitUrl).setDebug(true)
  FTSdk.install(config)

Log Examples

Data Synchronization
// Check whether the upload address is correctly configured in the SDK
[FT-SDK]FTHttpConfigManager com.demo D  serverUrl ==>
                                    Datakit Url:http://10.0.0.1:9529
// The following are connection error logs
[FT-SDK]SyncTaskManager com.demo   E  Network not available Stop poll
[FT-SDK]SyncTaskManager com.demo   E  ↵
            1:Sync Fail-[code:10003,response:failed to connect to 10.0.0.1 (port 9529) from ↵
            10.0.2.16 (port 47968) after 10000ms,检查本地网络连接是否正常]

// The following are normal synchronization logs
[FT-SDK]SyncTaskManager com.demo   D  Sync Success-[code:200,response:]

It is recommended to disable this configuration when releasing a Release build.

ft-plugin Debug Mode

You can enable Plugin debug logs with the following configuration. Once enabled, you can find [FT-Plugin] output logs in the Build output logs. Use these to view Plugin ASM writes.

FTExt {
    // Whether to display Plugin logs. Defaults to false.
    showLog = true
}

It is recommended to disable this configuration when releasing a Release build.

Convert SDK Internal Logs to Cache Files

// >= 1.4.6
// Default path: /data/data/{package_name}/files/LogInner.log
LogUtils.registerInnerLogCacheToFile()

// >= 1.4.5+ 
val cacheFile = File(filesDir, "LogCache.log")
LogUtils.registerInnerLogCacheToFile(cacheFile)

To ensure the integrity of internal logs, set this configuration before SDK initialization.

Missing Background Color for Pure Containers in Session Replay Compose Playback

When using Jetpack Compose Session Replay, if a page contains containers such as Row, Column, and Box that are used only for layout and background drawing, for example, with only Modifier.background(...) set but no text, click, semantics, or other accessibility information, the container may not appear in the Compose semantics node tree. Session Replay currently maps based on semantics nodes. As a result, the background color may be missing during replay, and the Toolbar or section backgrounds may appear as the default white.

If this background is important for the replay presentation, you can add an empty semantics marker to the container so that it enters the semantics node tree:

Row(
    modifier = Modifier
        .fillMaxWidth()
        .height(56.dp)
        .semantics { }
        .background(Color(0xFFFF6600))
)

This approach does not change the UI presentation. It only helps Session Replay capture the Compose container node. The SDK will continue to enhance automatic collection of backgrounds for containers without semantics in subsequent versions.

SDK Runs Normally but There Is No Data

  • Troubleshoot DataKit to check whether it is running normally

  • Confirm that the SDK upload address datakitUrl or datawayUrl is configured correctly and that the SDK is initialized correctly. In debug mode, check the logs to diagnose upload issues.

  • Check whether DataKit is uploading data to the corresponding workspace and whether it is offline. You can confirm this by logging in to Guance and viewing "Infrastructure".

Compatibility Issues with OkHttp 3.12.+

In ft-sdk < 1.6.13, if data compression is enabled with FTSDKConfig.setCompressIntakeRequests(true), SDK data collection works normally, but no error prompt is generated during data synchronization, and no HTTP status code logs are output.

Resolution: Using ft-sdk >= 1.6.13 or OkHttp 4.5.0 or later resolves this issue.

Data Loss

Partial Data Loss

  • If data for a RUM session, a Log, or several entries in a Trace is lost, first rule out whether sampleRate < 1 is set in FTRUMConfig, FTLoggerConfig, or FTTraceConfig.
  • Check the network of the device uploading data, as well as the network and load of the device where DataKit is installed.
  • Confirm that FTSdk.shutDown is called correctly. This method releases SDK data processing objects, including cached data.

Resource Data Loss

Automatic Collection Without Correct ft-plugin Integration

Automatic Resource collection relies on Plugin ASM bytecode instrumentation to automatically configure OkHttpClient Interceptor and EventListener and inject FTTraceInterceptor, FTResourceInterceptor, and FTResourceEventListener.FTFactory. If you do not use the Plugin, see here.

Custom WebView Automatic Collection Not Working

If collection works normally for native WebView pages but custom WebView pages do not trigger the expected automatic collection, it is recommended to first use Plugin logs to determine whether this is a WebView recognition issue.

How to Diagnose:

  1. First, refer to Integration Configuration and enable logs in FTExt:

    FTExt {
        showLog = true
        verboseLog = true
    }
    
  2. After recompiling, search the Build logs for output related to [FT-Plugin] and WEBVIEW, and focus on whether logs similar to the following appear:

    [FT-Plugin]:TARGET_CUSTOM_WEBVIEW_METHOD-> owner:com/example/CustomWebView, class:com/example/WebViewActivity$2, super:java/lang/Object, method:loadUrl(Ljava/lang/String;)V | onItemSelected(Landroid/widget/AdapterView;Landroid/view/View;IJ)V
    

If this type of TARGET_CUSTOM_WEBVIEW_METHOD log appears, the Plugin has recognized the current owner as a custom WebView and processed the corresponding call.

If this type of log is never matched, but the code actually calls a custom WebView from your business, you usually need to check whether that class has been added to knownWebViewClasses. This affects not only automatic collection recognition but also whether the Plugin continues to perform ASM writes on custom WebView internal methods as ordinary methods. If the WebView is not recognized correctly, methods such as loadUrl may be called recursively at runtime, ultimately resulting in a WebView white screen. During troubleshooting, you can also look for logs similar to the following:

knownWebviews.contains(owner) = false
owner: com/example/CustomWebView

This usually indicates that the current class has not yet been recognized by the Plugin as a WebView.

Resolution:

Add knownWebViewClasses in FTExt and include the custom WebView classes actually in use. It is recommended to add the WebView base class used in your business first. If the inheritance hierarchy is deep, you can add both the base class and the class currently in use. This enables the Plugin to correctly recognize WebView calls and prevents duplicate ASM writes to custom WebView internal methods.

FTExt {
    showLog = true
    verboseLog = true
    knownWebViewClasses = [
        'com.example.web.BaseWebView',
        'com.example.web.CustomWebView'
    ]
}

knownWebViewClasses adds custom business WebViews to the Plugin's known WebView list in advance. This resolves custom WebView recognition issues and works with the Plugin to skip duplicate writes to internal WebView methods, avoiding recursive calls and white screens at runtime.

OkHttpClient.build() Configuration Issues

Plugin ASM automatically injects network collection when the application calls OkHttpClient.Builder().build(). The following two situations may cause network collection to fail:

  1. Timing issue - SDK initialization not complete. If OkHttpClient.Builder().build() is called before SDK initialization is complete, empty configuration is loaded, and Resource-related data is lost. Check the debug logs to confirm whether the initialization order is correct.
  2. Creation method issue. The OkHttpClient object is not created using the standard OkHttpClient.Builder().build() method, for example, by directly instantiating OkHttpClient or using another construction method.
// SDK initialization logs
[FT-SDK]FTSdk   com.ft  D  initFTConfig complete
[FT-SDK]FTSdk   com.ft  D  initLogWithConfig complete
[FT-SDK]FTSdk   com.ft  D  initRUMWithConfig complete
[FT-SDK]FTSdk   com.ft  D  initTraceWithConfig complete

// Logs printed when SDK OkHttpClient.Builder.build() is called
// (Must be called after SDK initialization)
[FT-SDK]AutoTrack   com.ft  D  trackOkHttpBuilder    

If you cannot adjust the initialization call order, you can choose manual integration.

Data Is Reprocessed Using an Interceptor or EventListener

After Plugin ASM insertion, based on the original project code, addInterceptor is added to OkHttpClient.Builder(), adding FTTraceInterceptor and FTResourceInterceptor respectively. The contentLength of the body in the HTTP request is used in the unique ID calculation, and the data at each stage of Resource data is correlated through this ID. Therefore, if the integrator also adds addInterceptor when using OkHttp and reprocesses the data so that its size changes, the ID calculation at each stage becomes inconsistent, resulting in data loss.

Resolution:

ft-sdk < 1.4.1

By customizing the position order of addInterceptor, you can have the SDK method calculate the ID first, which resolves this issue. To avoid duplicate settings, the custom approach requires disabling enableTraceUserResource in FTRUMConfig and enableAutoTrace in FTTraceConfig.

ft-sdk >= 1.4.1

In scenarios where the SDK is not manually configured, it adapts to and is compatible with this issue automatically. If manual configuration has already been performed, ensure that the Interceptor is placed earlier.

Compatibility Issues with OkHttp 3.12.+

ft-sdk < 1.6.13 If the Interceptor in use reads the response body content, current Resource data may fail to be collected.

Resolution:

ft-sdk < 1.6.13

  1. Without changing the OkHttp version, resolve this issue through manual configuration.

    OkHttpClient.Builder builder = new OkHttpClient.Builder()
        .addInterceptor(new CustomReadReponseInterceptor())// Read the response body
        .addInterceptor(new FTTraceInterceptor())
        .addInterceptor(new FTResourceInterceptor())
        .addInterceptor(new CustomRequestBodyFixInterceptor())// Encrypts or modifies the body
        .eventListenerFactory(new FTResourceEventListener.FTFactory());
    
    OkHttpClient client = builder.build();
    
  2. Upgrading OkHttp to 4.5.0 or later also resolves this issue.

ft-sdk >= 1.6.13

In scenarios where the SDK is not manually configured, it is compatible with this issue.

Error Data Loss: Crash Data

  • Confirm whether another third-party SDK with Crash capture capabilities is also in use. If so, place the SDK initialization method after the other SDK.

Missing Information for a Data Field

User Data Fields

  • Confirm that the user data binding methods are called correctly. In debug mode, you can trace this issue through logs.

    [FT-SDK]FTRUMConfigManager com.demo D  bindUserData xxxx
    
    ///---> Your data operation <-----
    
    [FT-SDK]FTRUMConfigManager com.demo D unbindUserData
    

Custom Parameters Missing or Incorrect Values

  • Confirm that they are called in the correct scenarios. FTRUMConfig.addGlobalContext and FTLoggerConfig.addGlobalContext are suitable for scenarios that do not change during an application lifecycle, such as app channel provider and different app Flavor attributes. If you need real-time responses based on dynamic scenarios, you must manually call the RUM and Log APIs.
  • In debug mode, check the [FT-SDK]SyncTaskManager logs. You can use these logs to verify the correctness of custom field parameters.

Jank Issues When enableConsoleLog Is Enabled for Logs

If jank occurs, it may be caused by an excessively large volume of data collected by logs. FTLoggerConfig.enableConsoleLog works by intercepting android.util.Log and Java and Kotlin println calls. It is recommended to adjust the sampleRate, logPrefix, and logLevelFilters parameters under the configuration of FTLoggerConfig as needed to eliminate or mitigate this issue.

OkHttp EventListener Stops Working After SDK Integration

After Plugin AOP ASM insertion, based on the original project code, eventListenerFactory is added to OkHttpClient.Builder(), which overwrites the original eventListener or eventListenerFactory.

Resolution:

ft-sdk < 1.4.1

Disable automatic Plugin AOP configuration with FTRUMConfig setEnableTraceUserResource(false), and create a custom CustomEventListenerFactory that extends FTResourceEventListener.FTFactory, then integrate it using the custom approach.

ft-sdk >= 1.4.1

Create a custom CustomEventListenerFactory that extends FTResourceEventListener.FTFactory, and customize the eventListenerFactory written by ASM by setting FTRUMConfig.setOkHttpEventListenerHandler.

ft-sdk >= 1.6.7

In scenarios where the SDK is not manually configured, it is compatible with this issue.

TraceID Loss or Mismatch with Trace Propagation Header

When collecting complete request data, information usually needs to be obtained separately from the Interceptor and EventListener. To effectively associate these two parts of data, the SDK needs a unique ID to link the same network request. However, before version 1.6.10, this ID was the same for identical requests, which could cause data corruption or loss in high-concurrency scenarios. Starting from version 1.6.10, you can call FTSDKConfig.setEnableOkhttpRequestTag(true) or explicitly add a ResourceID to the Request to distinguish each request with a unique identifier, avoiding interference between identical requests. For configuration instructions, see here.

Feedback

Is this page helpful?