This apk is my recent update in production without proguard obfuscation or any optimization. Just in case so someone don't suggest it may be proguard related. However, I recently compiled with API 20: Android 4.4 Kitkat wear and set my target as API 21: L Preview. Eclipse compiled it successfully. I don't know if this could be a problem. I'm not sure if there are devices running on the L Preview yet. According to my google crash report all the devices that crashed where devices running on Android 4.4. This affected only less than 1% of my Android 4.4 installs. It stops working when the affected users try to open the app.
Below is the stack trace. Does anyone have any suggestions on how to fix this? Thanks.
java.lang.NullPointerException
at com.example.myproject.MainActivity$2.onItemClick(MainActivity.java:189)
at android.widget.AdapterView.performItemClick(AdapterView.java:308)
at android.widget.AbsListView.performItemClick(AbsListView.java:1495)
at android.widget.AbsListView$PerformClick.run(AbsListView.java:3453)
at android.widget.AbsListView$3.run(AbsListView.java:4816)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5487)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
at dalvik.system.NativeStart.main(Native Method)
Here are the lines included in the stack trace:
Lines 188-191 are:
SharedPreferences.Editor editor = getSharedPreferences("settings", 0).edit();
editor.putString("lastKnownLatitude", String.valueOf(mCurrentLocation.getLatitude()));
editor.putString("lastKnownLongitude", String.valueOf(mCurrentLocation.getLongitude()));
editor.commit();
The lines are within listview.setOnItemClickListener
and after editor.commit
it starts a new activity.