我从https://developers.google.com/maps/documentation/android-api/location?hl=en
获取了示例代码if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)
== PackageManager.PERMISSION_GRANTED) {
mMap.setMyLocationEnabled(true);
} else {
// Show rationale and request permission.
}
我使用上述代码,但在Android Studio中,ACCESS_FINE_LOCATION
被描述为带有红色字体的cannot resolve symbol ACCESS_FINE_LOCATION
。我已将<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
放在我的Androidmanifest
我该怎么做才能解决这个问题?
答案 0 :(得分:1)
您可以手动导入清单。
将import android.Manifest;
导入activity.java