Getting started with Android SDK

Hi,

i've just started getting to understand the Android SDK. I've followed the examples in the API documentation closely, but when I try and run the app, it stops immediately with the following log message:

05-19 21:53:04.601: E/AndroidRuntime(16959): FATAL EXCEPTION: main
05-19 21:53:04.601: E/AndroidRuntime(16959): Process: com.revealinternational.ipu.estimoredistancetest, PID: 16959
05-19 21:53:04.601: E/AndroidRuntime(16959): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.revealinternational.ipu.estimoredistancetest/com.revealinternational.ipu.estimoredistancetest.MainActivit
y}: java.lang.NullPointerException
05-19 21:53:04.601: E/AndroidRuntime(16959): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2231)
05-19 21:53:04.601: E/AndroidRuntime(16959): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2363)
05-19 21:53:04.601: E/AndroidRuntime(16959): at android.app.ActivityThread.access$900(ActivityThread.java:161)
05-19 21:53:04.601: E/AndroidRuntime(16959): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1265)
05-19 21:53:04.601: E/AndroidRuntime(16959): at android.os.Handler.dispatchMessage(Handler.java:102)
05-19 21:53:04.601: E/AndroidRuntime(16959): at android.os.Looper.loop(Looper.java:157)
05-19 21:53:04.601: E/AndroidRuntime(16959): at android.app.ActivityThread.main(ActivityThread.java:5356)
05-19 21:53:04.601: E/AndroidRuntime(16959): at java.lang.reflect.Method.invokeNative(Native Method)
05-19 21:53:04.601: E/AndroidRuntime(16959): at java.lang.reflect.Method.invoke(Method.java:515)
05-19 21:53:04.601: E/AndroidRuntime(16959): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
05-19 21:53:04.601: E/AndroidRuntime(16959): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
05-19 21:53:04.601: E/AndroidRuntime(16959): at dalvik.system.NativeStart.main(Native Method)
05-19 21:53:04.601: E/AndroidRuntime(16959): Caused by: java.lang.NullPointerException
05-19 21:53:04.601: E/AndroidRuntime(16959): at com.estimote.sdk.internal.Preconditions.checkNotNull(Preconditions.java:36)
05-19 21:53:04.601: E/AndroidRuntime(16959): at com.estimote.sdk.BeaconManager.<init>(BeaconManager.java:159)
05-19 21:53:04.601: E/AndroidRuntime(16959): at com.revealinternational.ipu.estimoredistancetest.MainActivity.<init>(MainActivity.java:30)
05-19 21:53:04.601: E/AndroidRuntime(16959): at java.lang.Class.newInstanceImpl(Native Method)
05-19 21:53:04.601: E/AndroidRuntime(16959): at java.lang.Class.newInstance(Class.java:1208)
05-19 21:53:04.601: E/AndroidRuntime(16959): at android.app.Instrumentation.newActivity(Instrumentation.java:1079)
05-19 21:53:04.601: E/AndroidRuntime(16959): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2222)

The target is a Galaxy S4 running Android 4.4.2. I am using API version 19.

If I get compile the demo I get the same problem. The Estimote app from the app store runs fine though.

Can you please give me some pointers as to what I am doing wrong.

Thanks
Alan

I found that my problem was because I did not have Bluetooth enabled, and I was not waiting for ranging to start.

Alan

Hi Alan,

I'm happy that you managed to come up with the proper solution even before I got a chance to reach out to you :)