Unable to initialize SDK

I downloaded the demo Airport tutorial and tried to run it.
I even did the whole tute but I keep getting the same error.

E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.example.airport, PID: 10734
java.lang.RuntimeException: Unable to instantiate service com.estimote.sdk.service.BeaconService: java.lang.NullPointerException: You need to initialize SDK first. EstimoteSDK.initialize(applicationContext, appId, appToken)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:2875)
at android.app.ActivityThread.access$1800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1455)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:155)
at android.app.ActivityThread.main(ActivityThread.java:5721)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1029)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:824)
Caused by: 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.EstimoteCloud.getInstance(EstimoteCloud.java:47)
at com.estimote.sdk.service.BeaconService.(BeaconService.java:154)
at java.lang.reflect.Constructor.newInstance(Native Method)
at java.lang.Class.newInstance(Class.java:1572)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:2872)
at android.app.ActivityThread.access$1800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1455)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:155)
at android.app.ActivityThread.main(ActivityThread.java:5721)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1029)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:824)
09-29 17:57:12.155 10734-10734/com.example.airport D/Process﹕ killProcess, pid=10734
09-29 17:57:12.155 10734-10734/com.example.airport D/Process﹕ com.android.internal.os.RuntimeInit$UncaughtHandler.uncaughtException:138 java.lang.ThreadGroup.uncaughtException:693 java.lang.ThreadGroup.uncaughtException:690

1 Like

Getting the same problem here since last 5 hours. Before that those examples seemed to be working.

I’m very sorry for that. I pushed a fix to SDK. Version 0.9.1.

Android tutorial and example project has been updated to use 0.9.1 version. In your local copy please do change in build.gradle version of the library from 0.9 to 0.9.1 or download new example again.

I have the updated version of the library - 0.9.1.
However, I’m still facing the same crash.

Here’s a part of the log:
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.EstimoteCloud.getInstance(EstimoteCloud.java:47)
at com.estimote.sdk.connection.BeaconConnection.authenticate(BeaconConnection.java:192)
at com.example.airport.MainActivity$3.onBeaconsDiscovered(MainActivity.java:121)
at com.estimote.sdk.BeaconManager$IncomingHandler.handleMessage(BeaconManager.java:660)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:5419)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)
at dalvik.system.NativeStart.main(Native Method)

Hi @sanketkhanwalkar, I’m not sure what’s your use case but exception message explains what needs to be done in order to fix it.

You need to initialize SDK first. EstimoteSDK.initialize(applicationContext, appId, appToken)