Recently i have used READ_PHONE_STATE permission in my app. At apk installation my phone showed me that my app needs to use Phone calls permission (inherently).
Then i removed that permission (deleted <uses-permission android:name="android.permission.READ_PHONE_STATE" /> line in manifest) and generated a new apk. While installing the new apk, phone still shows that my app needs Phone calls permission. I cleaned the project but the result is same.
How can these permissions be update?
Unlike with the java source files, changing the Manifest file alone tends not to trigger a true rebuild. Anytime you change one of your xml files, clean the project before re-deploying it.
Related
I added some libraries to an Android app and after upload to the Google Play Store I got this warning:
The main manifest file does not declare this permission, so I assume it comes from a library.
I then check out the source code of the previous version, which did not use this permission.
Looking at the merged manifest file in Android Studio, I still see the permission:
When I click on "Go to declaration" for this permission, it takes me to the main manifest file, which does not declare this permission.
I tried to clean and rebuild the project and restart Android Studio but the permission still shows in the merged manifest tab in Android Studio. It shows in the debug and release build variant.
Why is that?
After building your app you should be able to find a manifest merger report under app/build/outputs/logs. Among other things, this file lists the origin of every permission that has been added to the merged manifest.
I try to request permissions to use location data with a flutter app. I am using the geolocator plugin and permission_handler. Both added to my pubspec.yaml.
I have futhermore added
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
to my android/app/src/main/AndroidManifest.xml.
The first thing I do when I launch my app, is
PermissionHandler().requestPermissions([PermissionGroup.location]).then((val) {
...
});
If I then run this on either an emulator or on my physical phone, it returns a PermissionStatus.unknown and subsequent calls to GeoLocator() spams the console with
No permissions found in manifest for: $permission
If I go into app-settings it says that no special permissions were requested.
When I then open up the exact same project as an Android project (I am using Android Studio for both, there is a neat dropdown option to open Android project in Android Studio) and run it on my phone it works as expected - it asks for the permission and if I go into the app-settings I can also see the requested permission there.
Anyone have any idea why it does not get "propagated" with flutter?
It seems like the main issue is that the AndroidManifest.xml is not updated when simply relaunching the application. If, however, one first do a flutter clean and then rebuilds it, the AndroidManifest.xml is updated.
I am not sure if this the intended behavior, but it works. Just something to remember.
Just perform the following command at your command line
flutter clean
after adding permission in AndroidManifest.xml
You just need to perform the two steps:
Add the permissions in the android manifest file.
Execute the command flutter clean in your project.
Take it as a basic rule, after updating the manifest u have to clean the project.
I know(am I wrong?) that an Android app may request more permissions than specified in manifest file.
E.g. compiling with google play services, or some other third party libraries include permissions I am not aware of.
Is there a way to list all required permissions after building APK file?
I want to know of all requested permissions before publishing the app.
an Android app may request more permissions than specified in manifest file
on the manifest that the developer wrote him/herself yes, but on the manifest actually inside the .apk all the permissions are there
on android studio you can go to the manifest file and on the bottom left there's a little tab that says "merged manifest" that shows what your manifest will be on the final .apk.
Guess I have redundant permissions for my app in Apps → App info → Permissions: Phone and Storage. Indeed, previously in the Manifest were declared following permissions: WRITE_EXTERNAL_STORAGE and READ_PHONE_STATE. But when I have removed this permissions I still can see according options in App info page, even after reinstall of the app. So how can I remove this options?
This may occur because of Module project that you may be using in your project, i have experienced same problem by removing permissions from other module project
Building the release version of my application produces a manifest with a duplicate permission. The build completes successfully, but when I go to upload the new APK to production, I get the following error:
"Upload failed
Duplicate declarations of permission android.permission.READ_EXTERNAL_STORAGE with different maxSdkVersions"
In the intermediate manifests, the release AndroidManifest has the permission in question, but it only occurs once with maxSdkVersion (see below).
myapp/build/intermediates/manifests/release/AndroidManifest.xml
...
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<android:uses-permission
android:name="android.permission.READ_EXTERNAL_STORAGE"
android:maxSdkVersion="18" />
...
Note that READ_EXTERNAL_STORAGE is generated twice, once with the tag uses-permission and once with android:uses-permission.
This error has only occurred today; the last APK I successfully uploaded was about a week ago; no dependencies or permissions have changed in my project since that time.
What I would do:
Clean project and rebuild project (I guess you did).
Delete manually all generated files in folder "build", and rebuild the project.
Check if your different gradle files have different maxSDKVersion, and make them consistent.
Maybe this permission is included in any third library (I know you wrote you haven't, but you should have GooglePlayServices at least, and a SDK update maybe made the conflict) and you only have to remove it.
Nevertheless, I would only specify the android.permission.WRITE_EXTERNAL_STORAGE permission because it should also contains the READ_EXTERNAL_STORAGE one. If it works, maybe is not an explanation of what is happening to you but it's maybe enough.
I just ran into this issue as well. It turns out that one of the libraries that my project depends on includes the READ_EXTERNAL_STORAGE permission, but my actual project does not. Simply adding this permission to my project's manifest fixed the issue.
Cleaned and closed Android studio 10 times, maxSdkVersion is not set in my gradle files, set minSdkVersion consistently in all gradle files and nothing. The only thing that made the trick was manually deleting everything inside the Build folder and built again........problem vanished