Android 谷歌地图v2未在API 19上显示,但在API 24上显示
你好,我的应用程序有问题。 我在其中使用了Google Maps v2,它可以很好地与我的手机和带有API 24的模拟器配合使用。但在模拟器和API级别较低的设备上,它并没有改变地图 以下是我的权限:Android 谷歌地图v2未在API 19上显示,但在API 24上显示,android,google-maps,google-maps-android-api-2,Android,Google Maps,Google Maps Android Api 2,你好,我的应用程序有问题。 我在其中使用了Google Maps v2,它可以很好地与我的手机和带有API 24的模拟器配合使用。但在模拟器和API级别较低的设备上,它并没有改变地图 以下是我的权限: <uses-feature android:glEsVersion="0x00020000" android:required="true" /> <uses-permission android:name="android.permission.INTER
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission
android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
在较旧的设备上,它会转到onMapReady()并显示success,但没有显示地图。我希望你能帮助我:)也许你使用的是没有谷歌API的API 19 android图像integrated@MatPag谢谢你的来信。我认为这是一个带有谷歌API的图像。我也在旧设备上试用过,但也有同样的问题。我还尝试了Android Studio上的示例项目,但也存在同样的问题您是否尝试过使用SupportMapFragment而不是MapFragment?(记住在XML中也要更改)@MatPag是的,我也试过了,也是同样的问题。通常情况下,SupportMapFragment只支持12以下的API,我想日志中有消息吗?看起来API无法访问分幅。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_locate_activity"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="xxxxxxxxxxxxxxxxx.activities.LocateActivity">
<Button
android:id="@+id/set_action"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="@color/colorPrimary"
android:text="@string/set_button"
android:textColor="#fafafa" />
<fragment
android:id="@+id/map"
android:name="com.google.android.gms.maps.MapFragment"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_above="@id/set_action"
android:layout_alignParentTop="true"
tools:context=".activities.LocateActivity" />
</RelativeLayout>
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_locate);
MapFragment mapFragment = (MapFragment) getFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
requestPermissions(LOCATION_PERMS, LOCATION_REQUEST);
}
}
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
addOnMapClickListener();
initLayout();
}