You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I work for a bank and the security doesn't allow the app to use the WRITE_EXTERNAL_STORAGE and READ_EXTERNAL_STORAGE.
I realized that this permission was added to the manifest of my app.
Is there a way to avoid this permission using the image_picker plugin?
Hi @rlecheta,
What api level does your app target ?
Per the plugin's official documentation, for api > 29, no configuration is required and for api <= 29, there's a flag android:requestLegacyExternalStorage="true".
If you are on api <=29, you may try to set above flag to false and see if you see any issues while using the plugin.
Hi, with this flag:
android:requestLegacyExternalStorage="false"
My build never completes, it complains something about the cloud_firestore plugin:
logs
Launching lib/main.dart on Android SDK built forx86in debug mode...
Running Gradle task 'assembleDebug'...
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:processDebugResources'.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
Android resource linking failed
android/app/src/main/AndroidManifest.xml:14:5-57:19: AAPT: error: attribute android:requestLegacyExternalStorage not found.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 11s
The built failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetfier to solve the incompatibility.
Running Gradle task 'assembleAarRelease'...
Building plugin flutter_money_formatter...
Running Gradle task 'assembleAarRelease'...
✓ Built build/app/outputs/repo.
Building plugin cloud_firestore...
Exception: The plugin cloud_firestore could not be built due to the issue above.
In my build.gradle I have:
minSdkVersion 21
targetSdkVersion 29
Hi @rlecheta@rlechetaudemy (assuming you are same person with different usernames)with WRITE_EXTERNAL_STORAGE and READ_EXTERNAL_STORAGE entries intact in manifest file, do you get any error while building or does it prohibit to use image_picker plugin ?
@rlecheta,
Usually if you have minSdkVersion 21 and targetSdkVersion 29, then you won't explicitly need to specify the permissions in manifest.
I am on same settings and tried the official image_picker plugin example on latest Stable (1.20.1). When I try to access gallery or camera, it by default asks you for the permission as below:
Hi @darshankawar , sure it works like you explained. But please, read again what I explain in the first post.
The problem is that I didn't put the WRITE/READ permission in my Manifest, but during the manifest merge, the plugin put it there. If you Analyse your apk, you are going to see both permissions there, even if you don't wanna it.
My app doesn't pass the security requirements of my company because that.
It's very important that Flutter plugins doesn't put any unnecessary permissions on the Manifest if they are not necessary.
And finally, we are talking about some official plugin.
Hi @rlecheta
You can avoid this by using image_pickerlocally in your project and removing the permission line
I don't think write permission would be removed from the package itself
Closing as there is an easy solution to this. If you disagree, please write in the comments and I will reopen it.
Thank you
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.
Activity
darshankawar commentedon Aug 10, 2020
Hi @rlecheta,
What api level does your app target ?
Per the plugin's official documentation, for api > 29, no configuration is required and for api <= 29, there's a flag
android:requestLegacyExternalStorage="true".If you are on api <=29, you may try to set above flag to
falseand see if you see any issues while using the plugin.rlechetaudemy commentedon Aug 10, 2020
Hi, with this flag:
android:requestLegacyExternalStorage="false"
My build never completes, it complains something about the cloud_firestore plugin:
logs
In my build.gradle I have:
minSdkVersion 21
targetSdkVersion 29
darshankawar commentedon Aug 11, 2020
Hi @rlecheta @rlechetaudemy (assuming you are same person with different usernames)with
WRITE_EXTERNAL_STORAGEandREAD_EXTERNAL_STORAGEentries intact in manifest file, do you get any error while building or does it prohibit to useimage_pickerplugin ?rlecheta commentedon Aug 11, 2020
Hi, it throws the same exception, with or without the WRITE/READ permissions. Now my manifest is like this and I got the same error:
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="..."> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <application android:name="io.flutter.app.FlutterApplication" android:icon="@mipmap/ic_launcher" android:label="Gama Saúde" android:requestLegacyExternalStorage="false" >darshankawar commentedon Aug 12, 2020
@rlecheta,
Usually if you have
minSdkVersion 21andtargetSdkVersion 29, then you won't explicitly need to specify the permissions in manifest.I am on same settings and tried the official image_picker plugin example on latest Stable (1.20.1). When I try to access gallery or camera, it by default asks you for the permission as below:
rlecheta commentedon Aug 13, 2020
Hi @darshankawar , sure it works like you explained. But please, read again what I explain in the first post.
The problem is that I didn't put the WRITE/READ permission in my Manifest, but during the manifest merge, the plugin put it there. If you Analyse your apk, you are going to see both permissions there, even if you don't wanna it.
My app doesn't pass the security requirements of my company because that.
It's very important that Flutter plugins doesn't put any unnecessary permissions on the Manifest if they are not necessary.
And finally, we are talking about some official plugin.
darshankawar commentedon Aug 14, 2020
This will probably need for analysis, so keeping this issue open.
TahaTesser commentedon Feb 11, 2021
Hi @rlecheta
You can avoid this by using
image_pickerlocally in your project and removing the permission lineI don't think write permission would be removed from the package itself
Closing as there is an easy solution to this. If you disagree, please write in the comments and I will reopen it.
Thank you
github-actions commentedon Aug 5, 2021
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.