Uses_permission is ignored in androidmanifest.xml

I have this strange error while building my project in Android Studio. Basically my application uses GPS to get the current location of the user. So in my androidmanifest.xml I placed this line:

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

      

But while creating the application, 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 lastKnownLocation, the application works fine (and will most likely use a different resolution).

EDIT: The permission tag is not part of the app tag.

Does anyone know this error?

+3


source to share


2 answers


Place it outside the app 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 show no problem in this case.

+4


source


OK, now I will rebuild the whole manifest file and the error is gone. But it's essentially just a 1: 1 copy of the old manifest file. So it's the mystery that caused the error in the first place.



Thanks for the help and advice!

0


source







All Articles