Neither user nor current process has android.permission.ACCESS_COARSE_LOCATION

♀尐吖头ヾ 提交于 2019-11-29 03:37:43

This means you have some wrong information or malformed info in your menifest file and that is the reason none of your Permission is not identified by your app. Just make sure you have cleaned ANDROIDMANIFEST file with any malformed data.

It will work and all permission should be outside Application tag

If you are running on a device on Android Marshmallow and above:

If the device is running Android 6.0 or higher and if the app's target SDK is 23 or higher, the app not just have to list the permissions in the manifest but also must request each dangerous permission it needs while the app is running.

More info:

http://developer.android.com/training/permissions/requesting.html

and

http://developer.android.com/guide/topics/security/permissions.html#normal-dangerous

move the uses-permission outside application just below the manifest tag

user6175333

Moving permission section solved my problem with "Neither user or current process has android.permission.READ_PHONE_STATE". Thank you so much to everyone in this forum. In reference to others, my changes are bellow:

Original:

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


    <uses-feature
        android:name="android.hardware.nfc"
        android:required="true" />

    <activity android:name=".NfcRead"></activity>
</application>

Change:

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

    <uses-feature
        android:name="android.hardware.nfc"
        android:required="true" />

    <activity android:name=".NfcRead"></activity>
</application>

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

This exception is related to the runtime permission system in Android 6 and above. The Location permission comes under dangerous permission [check here], so you must have to fulfill below 2 minimum requirements to handle these permissions:

  1. Declared below 2 permission in manifest (These permissions must be outside application tag)

    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />  
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION " />
    
  2. Check for the granted permission at runtime using checkSelfPermission() and request permissions using requestPermissions() if not already granted.

If you have already done both of the above then and still getting error then check below:

  1. You App's targetSdkVersion (should be >=23) [If the application's targetSdkVersion is set to less than 23. It will be assumed that application is not tested with new permission system yet and will switch to the same old behavior: user has to accept every single permission at install time and they will be all granted once installed].
  2. Check if you have any thing wrong with you manifest file. You might have malformed manifest file.
  3. Check if you are calling any function, that works on location data, before the user Accept/revoked runtime location permission dialog?
  4. Clean you app (Clean build) and re-run.

Hope this may help :-)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!