2016-03-27 99 views
7

我有這樣的代碼不能解析符號ACCESS_FINE_LOCATION

if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) { 

在清單中,我已經包括此權限

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> 

但我得到錯誤cannot resolve symbol 'ACCESS_FINE_LOCATION'

如何解決這個問題呢?

+0

它在這裏也得到解決: http://stackoverflow.com/questions/34139048/cannot-resolve-manifest-permission-access-fine-location –

回答

8

這個權限是Android包

android.Manifest.permission.ACCESS_FINE_LOCATION 
0

之前應用標籤將這個權限在AndroidManife.xml開始

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> 
5

import android.Manifest;因爲有時它使用類清單