我在我的Android应用程序中使用谷歌地图,我最近从运行Android 6.0的三星设备发生了崩溃。
这是我收到的例外情况:
Fatal Exception: java.lang.NullPointerException: Attempt to invoke interface method 'int java.util.List.size()' on a null object reference
at maps.d.d$c$1.a(:com.google.android.gms.alldynamite:102)
at maps.d.f$1.findAccessibilityNodeInfosByText(:com.google.android.gms.alldynamite:50)
at android.view.AccessibilityInteractionController.findAccessibilityNodeInfosByTextUiThread(AccessibilityInteractionController.java:356)
at android.view.AccessibilityInteractionController.access$700(AccessibilityInteractionController.java:54)
at android.view.AccessibilityInteractionController$PrivateHandler.handleMessage(AccessibilityInteractionController.java:1200)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7229)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
知道造成这种情况的原因是什么?
我的代码:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Fabric.with(this, new Answers(), new Crashlytics());
setContentView(R.layout.place_picker);
//Retrieve Map fragment
mapFragment = (MapFragment) getFragmentManager().findFragmentById(R.id.map);
}
@Override
public void onMapReady(GoogleMap map) {
Log.d(TAG, "onMapReady. ");
googleMap = map;
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
requestLocationPermissions();
} else {
configureMap();
startLocationUpdates();
}
}