Currently I am working on flutter to download videos from server on to user's device like udemy, so that they can download and watch videos. It's working fine in debug mode but when i am running it in profile mode it's not working. I think i am not asking for permission that may be a reason why it's not working. To test this i added permission_handler package but it is giving me this error
C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\permission_handler_android-10.2.0\android\src\main\java\com\baseflow\permissionhandler\PermissionManager.java:469: error: cannot find symbol
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) {
The problem is we cannot upgrade our sdk as we need lower sdk for our targeted users. I am trying to find out if there is any way we can ask storage permission either without the permission_handler or any work around with the same package.
Thanks in advance.
CodePudding user response:
I can't be sure, but I believe this is an issue with your compileSdkVersion
in your build.gradle
file being too low.
It's common for developers to assume that the app has to be compiled to the lowest common target, but it should normally be set as high as possible. TargetSdkVersion is then set to your lowest targeted app build. That way, newer devices get access to newer Android API features, and older devices have older API features available for their devices.
In practice, this will mean that older Android builds will not be shown the permission request prompt and it will be assumed to be true when using permission_handler.
This github issue mentions a similar error to yourself where changing the CompileSdkVersion was the solution: https://github.com/Baseflow/flutter-permission-handler/issues/685
This SO answer explains the differences between compileSdkVersion and other Sdk version attributes inside your build.gradle: What is the difference between compileSdkVersion and targetSdkVersion?