Troubleshooting¶
Compilation Troubleshooting¶
If an error occurs during the compilation process, the first step is to check the compilation environment.
Runnable Compilation Environment¶
✅ Runnable Environment¶
- AGP
com.android.tools.build:gradleversion3.5.0or above - Gradle version
5.4.0or above - Java version
8.0or above - Android minSdkVersion 21
Note: As Android Studio versions are updated, the compatibility of these versions may also change. If you encounter compilation errors despite meeting the above conditions, please contact our developers.
⚠️ Compatible Environment¶
- AGP
com.android.tools.build:gradleversion3.0.1or above - Gradle version
4.8.1or above - Java version
8.0or above - Android minSdkVersion 21
The
ft-plugincannot be used in this environment. The automatic data capture part requires manual integration. For more details on manual integration, refer to here.
SDK Unable to Resolve Import¶
The above errors occur because the maven repository is not correctly set up. Please refer to 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)
3.0.0. This issue explains the problem. You can resolve it by upgrading AGP to 3.1.0 or above, or by using a newer SDK version. Upgrade the version in app/build.gradle as follows:
dependencies {
implementation('com.cloudcare.ft.mobile.sdk.tracker.agent:ft-sdk:1.3.10.beta01')//1.3.10 or above
}
API 'android.registerTransform' is obsolete¶
Transform has been marked as Deprecated in AGP 7.0 and has been removed in AGP 8.0. ft-plugin:1.2.0 has been adapted accordingly. Please upgrade to the corresponding version to fix this error. For specific instructions, refer to Integration Configuration
AndroidComponentsExtension ClassNotFoundException¶
AndroidComponentsExtension is a method supported by AGP 7.4.2. If your compilation environment is below this version, this error will occur. You can use the ft-plugin-legacy version to fix this error. For specific instructions, refer to Integration Configuration
java.lang.IllegalArgumentException:¶
- Invalid opcode 169
If this error occurs while using ft_plugin_legacy, it is due to a bug in the asm-commons:7.0 version. The original issue is here. You can resolve this issue by depending on org.ow2.asm:asm-commons:7.2 or above in the plugin configuration. Use ./gradlew buildEnvironment to confirm the actual asm-commons version being used.
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 below 7.0
The current plugin version only supports build environments using org.ow2.asm:asm7.x or above. Use ./gradlew buildEnvironment to query the build environment and confirm this issue. This problem can be fixed by forcibly depending on version 7.x or above. It is recommended to use version 7.2 or above.
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 Verification¶
Check Logcat to see if there are logs with Level as Error and Tag prefixed with [FT-SDK].
[FT-SDK] com.demo E Please install the SDK first (call FTSdk.install(FTSDKConfig ftSdkConfig) when the application starts)
Enable Debug Mode¶
ft-sdk Debug Mode¶
You can enable the SDK's debug function with the following configuration. Once enabled, the SDK debug logs will be output to the console LogCat. You can filter the [FT-SDK] characters to locate the Guance SDK logs.
Log Samples¶
Data Synchronization¶
//Check if the upload address is correctly entered into the SDK configuration
[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, check if the local network connection is normal]
//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 the Release version
ft-plugin Debug Mode¶
You can enable the Plugin's debug logs with the following configuration. Once enabled, you can find the [FT-Plugin] output logs in the Build output logs. Use this to check the Plugin ASM write status.
It is recommended to disable this configuration when releasing the Release version
SDK Internal Logs Converted 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, this configuration must be set before SDK initialization
SDK Running Normally but No Data¶
-
Check if Datakit is running normally
-
Confirm that the SDK upload address
datakitUrlordatawayUrlis configured correctly and initialized correctly. In debug mode, check the logs to determine upload issues. -
Check if datakit is uploading data to the corresponding workspace and if it is offline. This can be confirmed by logging into Guance and checking the "Infrastructure".
Compatibility Issues with Okhttp 3.12.+¶
ft-sdk < 1.6.13, if data upload compression is enabled FTSDKConfig.setCompressIntakeRequests(true), you may find that the SDK collects data successfully, but there are no error prompts during data synchronization, and no http code logs are printed.
Solution: Use ft-sdk >= 1.6.13 or okhttp 4.5.0 or above to resolve this issue.
Data Loss¶
Partial Data Loss¶
- If some Session data or Log, Trace data is missing, first check if
sampleRate < 1is set in FTRUMConfig, FTLoggerConfig, FTTraceConfig. - Check the network of the device uploading data and the network and load of the device where datakit is installed.
- Confirm that
FTSdk.shutDownis called correctly. This method will release the SDK data processing objects, including cached data.
Resource Data Loss¶
Automatic Collection, ft-plugin Not Correctly Integrated¶
Resource automatic collection requires Plugin ASM bytecode writing to automatically set OkHttpClient Interceptor and EventListener, writing FTTraceInterceptor, FTResourceInterceptor, FTResourceEventListener.FTFactory. If Plugin is not used, refer to here
OkHttpClient.build() Setup Issues¶
Plugin ASM will automatically inject network collection functionality when the application calls OkHttpClient.Builder().build(). The following two situations may cause network collection to fail:
1. Timing issue - SDK initialization is not complete. If OkHttpClient.Builder().build() is called before SDK initialization is complete, it will result in loading empty configurations, leading to loss of Resource related data. Check the debug logs to confirm the initialization sequence is correct.
2. Creation method issue. The standard OkHttpClient.Builder().build() method is not used to create the OkHttpClient object, such as directly instantiating OkHttpClient or using other construction methods.
//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
//SDK OkHttpClient.Builder.build() call logs
// (needs to be called after SDK initialization)
[FT-SDK]AutoTrack com.ft D trackOkHttpBuilder
If the initialization call sequence cannot be adjusted, you can choose to manually integrate.
Data is Processed Twice Using Interceptor or EventListener¶
After Plugin ASM is inserted, addInterceptor will be added to OkHttpClient.Builder() in the original project code, adding FTTraceInterceptor and FTResourceInterceptor, which use the http request body contentLength to participate in the unique id calculation. The data of each stage of Resource is connected through this id. Therefore, if the integrator also uses addInterceptor in Okhttp and processes the data twice, causing changes in size, it will lead to inconsistent id calculations in each stage, resulting in data loss.
Solution:
-
ft-sdk < 1.4.1
By customizing the order of
addInterceptor, let the SDK method calculate the id first, which can solve this problem. To avoid duplicate settings, the custom method needs to disableFTRUMConfig'senableTraceUserResourceandFTTraceConfig'senableAutoTraceconfigurations. -
ft-sdk >= 1.4.1
The SDK has adapted to this issue in non-manual setup scenarios. If manual setup has been performed, ensure that
Interceptoris in a forward position.
Compatibility Issues with Okhttp 3.12.+¶
ft-sdk < 1.6.13 If the Interceptor used reads the response body content for read, it may result in the inability to collect the current Resource data.
Solution:
-
ft-sdk < 1.6.13
- Without changing the Okhttp version, manually set up to resolve this issue
* Upgrading Okhttp to 4.5.0 or above can also resolve this issue. * ft-sdk >= 1.6.13OkHttpClient.Builder builder = new OkHttpClient.Builder() .addInterceptor(new CustomReadReponseInterceptor())//Read response body .addInterceptor(new FTTraceInterceptor()) .addInterceptor(new FTResourceInterceptor()) .addInterceptor(new CustomRequestBodyFixInterceptor())//Encrypt or modify body .eventListenerFactory(new FTResourceEventListener.FTFactory()); OkHttpClient client = builder.build();The SDK has adapted to this issue in non-manual setup scenarios.
Error Data Loss Crash Type Data¶
- Confirm if other third-party SDKs with Crash capture functionality are used simultaneously. If so, place the SDK initialization method after other SDKs.
Missing Field Information in Data¶
User Data Fields¶
-
Confirm that the user data binding method is called correctly. In debug mode, you can track this issue through logs.
Missing Custom Parameters or Incorrect Values¶
- Confirm that
FTRUMConfig.addGlobalContext,FTLoggerConfig.addGlobalContextare called in the correct scenarios. These are suitable for data that does not change within an application cycle, such as application channels, different Flavor attributes, etc. If dynamic scenarios require real-time responses, use manual calls to RUM and Log interfaces. - In debug mode, check the
[FT-SDK]SyncTaskManagerlogs to verify the correctness of custom field parameters.
Lagging Issues When Enabling enableConsoleLog¶
If lagging occurs, it may be due to excessively large log data. The principle of FTLoggerConfig.enableConsoleLog is to capture android.util.Log, Java and Kotlin println. It is recommended to adjust FTLoggerConfig configuration parameters such as sampleRate, logPrefix, logLevelFilters as needed to eliminate or alleviate this issue.
Okhttp EventListener Fails After Integrating SDK¶
After Plugin AOP ASM is inserted, eventListenerFactory will be added to OkHttpClient.Builder() in the original project code, which will overwrite the original eventListener or eventListenerFactory.
Solution:
-
ft-sdk < 1.4.1
Disable the automatic Plugin AOP setup
FTRUMConfig setEnableTraceUserResource(false), and customize a CustomEventListenerFactory inheritingFTResourceEventListener.FTFactory, and use custom integration. -
ft-sdk >= 1.4.1
Customize a CustomEventListenerFactory inheriting
FTResourceEventListener.FTFactory, and customize the ASM-writteneventListenerFactoryby settingFTRUMConfig.setOkHttpEventListenerHandler. -
ft-sdk >= 1.6.7
The SDK has adapted to this issue in non-manual setup scenarios.
TraceID Missing or Not Matching Trace Propagation Header¶
When collecting complete request data, information usually needs to be obtained from both Interceptor and EventListener. To effectively associate these two parts of data, the SDK needs to use a unique ID to link the same network request. However, before version 1.6.10, this ID was the same for the same request, which could lead to data confusion or loss in high concurrency scenarios. Since version 1.6.10, you can call FTSDKConfig.setEnableOkhttpRequestTag(true) or explicitly add ResourceID to the Request to distinguish unique identifiers for each request, avoiding interference issues between the same requests. For setup instructions, refer to here

