flutter-geolocator icon indicating copy to clipboard operation
flutter-geolocator copied to clipboard

Unhandled Exception: No location permissions are defined in the manifest. Make sure at least ACCESS_FINE_LOCATION or ACCESS_COARSE_LOCATION are defined in the manifest.

Open joao10martins opened this issue 1 year ago • 2 comments

🐛 Bug Report

Unhandled Exception: No location permissions are defined in the manifest. Make sure at least ACCESS_FINE_LOCATION or ACCESS_COARSE_LOCATION are defined in the manifest.

I've added the permissions on the manifest and the info.plist, still the library will give this error when I run the app.

image

Expected behavior

Run and ask for permission.

joao10martins avatar Sep 17 '22 15:09 joao10martins

This seems a configuration mistake. I cannot reproduce the problem (apart from removing the permissions form the AndroidManifest.xml file).

Please make sure you added the permissions to the AndroidManifest.xml file located in the android/app/src/main folder and the syntax is correct.

As an sample have a look at the example configuration.

If that doesn't help please provide the following information:

  • Output of the flutter doctor -v command.
  • Contents of your android/app/src/main/AndroidManifest.xml file.

mvanbeusekom avatar Sep 17 '22 18:09 mvanbeusekom

@mvanbeusekom flutter doctor shows all good. I suspect it has something to do with Gradle but I don't know why. Here's the manifest: image

joao10martins avatar Sep 18 '22 09:09 joao10martins

Hi @joao10martins,

Another option that might give some a clue is to check the build/app/outputs/logs/manifest-merger-release-report.txt file? This is generated after you make a release build. This file contains all information on how the final AndroidManifest.xml is created and which merge actions occurred.

This log might give some information about the permissions being removed or skipped during the build process and help locate the mistake. The log might contain some sensitive information so be careful to post it anywhere.

Another thing you might want to try is to build the .apk and use Android Studio Build -> Analyse APK... feature to look at the final AndroidManifest.xml file that is shipped with the binary, just to make sure this .apk file contains the required permissions. If not, some script (possible other plugin) explicitly removes them resulting in the exception. This should show up in the earlier mentioned log.

Hope this will help you on the way debugging this issue, if you have any follow up information please don't hesitate to leave a comment.

mvanbeusekom avatar Sep 23 '22 09:09 mvanbeusekom

I fixed it, notice that permissions is written with 3 's' characters :)

joao10martins avatar Sep 28 '22 07:09 joao10martins

Hahaha nice, I also completely missed that. Good to hear it is fixed and thanks for letting us know.

mvanbeusekom avatar Sep 28 '22 07:09 mvanbeusekom

@mvanbeusekom flutter doctor shows all good. I suspect it has something to do with Gradle but I don't know why. Here's the manifest: image

i face this problem how i can fix that androidxml for android geolocator pleas help me

ApurvMalani avatar Mar 17 '23 10:03 ApurvMalani