Reputation: 87
I've got this strange error when building my project in Android Studio. Basically my app uses GPS to get the current location of the user.So in my androidmanifest.xml i've placed this line:
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
But when building the app,this exception keeps popping up:
E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.SecurityException: Provider gps requires ACCESS_FINE_LOCATION permission
When using the networkprovider for the lastKnownLocation, the app works fine (and will most likely use another permission).
EDIT: the permissions tag is not within the Application tag.
Does anyone recognize this error?
Upvotes: 3
Views: 664
Reputation: 87
OK, I've now rebuild the entire manifestfile and the error is gone. But essentially this is just a 1:1 copy of the old manifest file. So it's still a mystery what caused the error in the first place.
Thanks for all the help and advice!
Upvotes: 0
Reputation: 12530
Place it outside application tag.
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>
<application.....
Make sure the uses-permission element is not inside the application element. Android Studio will not show any problem in this case.
Upvotes: 4