我无法在Android M上显示谷歌地图.
这是布局xml:
AndroidManifest文件:
内部应用程序标签:
我在运行时请求权限:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && (checkSelfPermission(Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED || checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED)) { requestPermissions(new String[]{Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION}, PERMISSION_REQUEST_COARSE_LOCATION); }
这是回调:
@Override public void onRequestPermissionsResult(int requestCode,String permissions[], int[] grantResults) { switch (requestCode) { case PERMISSION_REQUEST_COARSE_LOCATION: { if (grantResults[0] == PackageManager.PERMISSION_GRANTED && grantResults[1] == PackageManager.PERMISSION_GRANTED) { //Access Location } else { Utils.showToast(getApplicationContext(), "Until you grant the permissions, You cannot Access Location Service"); } } break; } }
我得到了这个例外
"android.view.InflateException: Binary XML file line #: Error inflating class fragment" only on Android 6.
它显示的地图在其他版本的android上没有任何问题.请帮我.