Estimote / Android-Fleet-Management-SDK

Estimote Fleet Management SDK for Android
https://developer.estimote.com
MIT License
836 stars 451 forks source link

NullPointerException - Nearable packet parsing error #163

Closed kamilwlf closed 8 years ago

kamilwlf commented 8 years ago

Sometimes I see this in logs. Should I care?

D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=6 08-17 11:24:52.321 19393-19497/E/EstimoteSDK: com.estimote.sdk.service.BeaconService$6.onLeScan:994 Nearable packet parsing error java.lang.NullPointerException: You need to initialize SDK first. EstimoteSDK.initialize(applicationContext, appId, appToken) at com.estimote.sdk.internal.Preconditions.checkNotNull(Preconditions.java:21) at com.estimote.sdk.cloud.internal.InternalEstimoteCloud.getInstance(InternalEstimoteCloud.java:71) at com.estimote.sdk.service.internal.NearableResolver$1.load(NearableResolver.java:28) at com.estimote.sdk.service.internal.NearableResolver$1.load(NearableResolver.java:25) at com.estimote.sdk.internal.utils.AsyncCache.get(AsyncCache.java:155) at com.estimote.sdk.service.internal.NearableResolver.tryToResolve(NearableResolver.java:47) at com.estimote.sdk.service.BeaconService$6.onLeScan(BeaconService.java:983) at com.estimote.sdk.service.BeaconService$3$1.run(BeaconService.java:404) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:148) at android.os.HandlerThread.run(HandlerThread.java:61)

U use 'com.estimote:sdk:0.11.0@aar'

pawelDylag commented 8 years ago

Hello @kamilwlf

Well, this doesn't affect anything. This log is posted when our SDK is trying to resolve your owned nearables in your area. But it can not do that because you haven't initialized your sdk with proper app id and app token. Anyway thanks for reporting that - we will remove this log in next release, so it won't bother you anymore :)

maass-bezirk commented 8 years ago

I was originally using Android SDK version 0.10.4 because that's what the setup tutorial uses (http://developer.estimote.com/android/tutorial/part-1-setting-up/). All I am using is nearable discovery, thus I add a nearable listener and start discovery. This works just fine with 0.10.4.

I saw today that there is a version 0.11.0, thus I decided to try it. I started getting the exact same exception as in the op. I assume this exception is because the SDK is trying to look up the nearable type in the cloud but I didn't initialize the SDK (because I don't want the cloud). Fine, just set the type to UNKOWN. Having said that, there does seem to be an effect: the SDK no longer discovers any nearables. Weirdly, it still calls the nearable listener, but with an empty list.