launchdarkly / android-client-sdk

LaunchDarkly Client-side SDK for Android
Other
45 stars 23 forks source link

Can't init the LDClient that return Future<LDClient> in background thread #65

Closed jazzyjester closed 5 years ago

jazzyjester commented 5 years ago

Hello, Thanks for a great library and service.

I notice an issue related to initialization the launch darkly when using the init method that return Future<LDClient>

When I run this init inside background thread, I receive this error :

01-28 11:31:01.939 Can't create handler inside thread that has not called Looper.prepare() 01-28 11:31:01.939 init failed java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare() at android.os.Handler.(Handler.java:200) at android.os.Handler.(Handler.java:114) at com.launchdarkly.android.Throttler.(Throttler.java:39) at com.launchdarkly.android.LDClient.(LDClient.java:223) at com.launchdarkly.android.LDClient.init(LDClient.java:102)

When I run it inside UI thread, it works. Can you please check why I can't run it inside background thread ? Thanks. Ronny.

gwhelanLD commented 5 years ago

Hi Ronny,

Thank you for the report, we'll take a look into this issue and update you when we know more.

Thanks, Gavin Whelan SDK Team

arun251 commented 5 years ago

@jazzyjester can you confirm you're using LaunchDarkly SDK v2.5.3 or later? We should have fixed it in 2.5.3.

jazzyjester commented 5 years ago

@arun251 I was using 2.5.2, without the fix, Checked with 2.5.3 version and it was fixed ! Thank you !

gwhelanLD commented 5 years ago

@jazzyjester Thanks for checking your version and confirming the fix, closing as resolved in 2.5.3+.