ANR on ActivityLifecycleCallback.register
Describe the bug We are getting ANR reports in Firebase Crashlytics and stack trace points to the below code snippet
com.clevertap.android.sdk.CleverTapAPI.getDebugLevel (CleverTapAPI.java) com.clevertap.android.sdk.Logger.getStaticDebugLevel (Logger.java:204) com.clevertap.android.sdk.Logger.i (Logger.java:40) com.clevertap.android.sdk.ActivityLifecycleCallback.register (ActivityLifecycleCallback.java:82) com.clevertap.android.sdk.ActivityLifecycleCallback.register (ActivityLifecycleCallback.java:92) com.rapido.passenger.RapidoApplication.initCleverTapSdk (RapidoApplication.kt:128) com.rapido.passenger.RapidoApplication.onCreate (RapidoApplication.kt:62) android.app.Instrumentation.callApplicationOnCreate (Instrumentation.java:1192) android.app.ActivityThread.handleBindApplication (ActivityThread.java:7294) android.app.ActivityThread.access$1700 (ActivityThread.java:299) android.app.ActivityThread$H.handleMessage (ActivityThread.java:2184) android.os.Handler.dispatchMessage (Handler.java:106) android.os.Looper.loop (Looper.java:264) android.app.ActivityThread.main (ActivityThread.java:8312) java.lang.reflect.Method.invoke (Native method) com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:632) com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1049)
Screenshots/Logs
Environment (please complete the following information):
- Device: Across Devices
- OS: Across OS Versions
- CleverTap SDK Version 7.0.0
- Android Studio Version: Android Studio Koala Feature Drop | 2024.1.2 Patch 1 Build #AI-241.19072.14.2412.12360217, built on September 12, 2024
@sonusourav-rapido
- Can you confirm if
ActivityLifecycleCallback.registeris called before super.onCreate() of your application class? - On internal benchmarking the above operation took merely ~5ms on an average. It could be possible that the ANR is related to slow startup time and the logs are misleading. Can you confirm the same by
val timeTaken = measureTimeMillis {
ActivityLifecycleCallback.register(this)
}
// log timetaken
- There is no
StrictModeViolationeither which directly pertains to the above operation.
@Anush-Shand
- Yes,
ActivityLifecycleCallback.registerget called before super.onCreate(). - It showed ~28 ms for me. But not able to understand if the clevertap initialisation is the first thing happening on our application, what else related to our code could be causing that, and pointing to clevertap 🤔
- There is no StrictModeViolation
@sonusourav-rapido Since the ActivityLifecycleCallback.register(this) takes ~28ms and there are no StrictModeViolations reported from the SDK side it points to the possibility that the clevertap code is simply a false alarm and there is some other piece of slow running code leading to the ANR
Is there anything needed from the Clevertap team on this?
Closing this due to inactivity