Skip to content

LDConfig.java line 36 com.launchdarkly.sdk.android.LDConfig.<clinit> #167

@mohanK22

Description

@mohanK22

Hi LaunchDarkly Team,

We are getting the following the ANR report in our firebase crashlytics.

Logs as per Firebase Crashlytics

main (runnable): tid=1 systid=14022
at com.google.gson.Gson.(Gson.java:202)
at com.google.gson.GsonBuilder.create(GsonBuilder.java:597)
at com.launchdarkly.sdk.android.LDConfig.(LDConfig.java:36)
at com.launchdarkly.sdk.android.LDConfig$Builder.(LDConfig.java:299)
at com.tatadigital.tcp.common.di.AppModule.provideLaunchDarklyInstance(AppModule.java:831)
at com.tatadigital.tcp.common.di.AppModule_ProvideLaunchDarklyInstanceFactory.provideLaunchDarklyInstance(AppModule_ProvideLaunchDarklyInstanceFactory.java:42)
at com.tatadigital.tcp.DaggerTcpApplication_HiltComponents_SingletonC$SwitchingProvider.get(DaggerTcpApplication_HiltComponents_SingletonC.java:11475)
at dagger.internal.DoubleCheck.get(DoubleCheck.java:47)
at com.tatadigital.tcp.DaggerTcpApplication_HiltComponents_SingletonC.injectTcpApplication2(DaggerTcpApplication_HiltComponents_SingletonC.java:2177)
at com.tatadigital.tcp.DaggerTcpApplication_HiltComponents_SingletonC.injectTcpApplication(DaggerTcpApplication_HiltComponents_SingletonC.java:2143)
at com.tatadigital.tcp.Hilt_TcpApplication.onCreate(Hilt_TcpApplication.java:43)
at com.tatadigital.tcp.TcpApplication.onCreate(TcpApplication.java:48)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1192)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7294)
at android.app.ActivityThread.access$1700(ActivityThread.java:299)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2184)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:264)
at android.app.ActivityThread.main(ActivityThread.java:8312)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:632)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1049)

Implementation

We are using the hilt library in our project and the following function is created in the AppModule class which is annotated with @Module and @InstallIn(SingletonComponent::class).

    @Provides
    fun provideLaunchDarklyInstance(@ApplicationContext appContext: Context): LDClient {
        val ldConfig: LDConfig = LDConfig.Builder()
            .mobileKey(BuildConfig.LD_KEY)
            .build()

        val user: LDUser = LDUser.Builder(LD_USER_KEY)
            .custom(TEST_KEY_1, TEST_VALUE_1)
            .custom(TEST_KEY_2, TEST_VALUE_2)
            .build()

        return LDClient.init(appContext as MyApplication, ldConfig, user, 0)
    }

In our application class, we are just injecting the ldClient object.

@Inject
lateinit var ldClient: LDClient

SDK version
We are using launchDarkly SDK version 3.1.1
implementation 'com.launchdarkly:launchdarkly-android-client-sdk:3.1.1'

Let me know if you need more information.
Thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions