Closed burhansvural closed 2 weeks ago
What type of android device do you test on? Please provide some more details for testing.
Pixel 3a API 34 x86_64 Emulator Pixel 8 Pro API 35 x86_64 Emulator Redmi Note8 - Android 11 RKQ1 - MIUI 12.5.2 Poco - Android 12 SKQ1 - MIUI Global 13.0.1 Samsung Galaxy A31 - Android 12 - One UI 4.1 Redmi Note 10S - Android 12 SP1A - MIUI 13.0.13
I also encountered a similar problem with requesting permissions on Android 12
I tried the basic example on the page https://flet.dev/docs/controls/permissionhandler/ for an initial test of the usage But in practice, clicking did not open a permission request. It didn't show up as an option in the settings either. In practice, permissions that were already open remained so, and blocked permissions remained blocked
Ah, @burhansvural, seems like you are trying to check/request the contacts permissions. It doesnt work certainly because the flet-build-template doesnt contain these permissions yet.
Why? What we were trying to avoid is to have all these permissions (contacts, camera, phone, calendar etc) in the build-template because not everyone will need, and it might also lead to rejection of apps when they are submitted to the stores: "why does your app needs all these permissions, though it seems like it doesn't makes use of all?"
In #3345 (subscribe to it), we could make everything dynamic: on could define from that file which permissions should be added to the build-template, so that only the required/used permissions are included.
However, you can download the flet-build-template and add these permissions to it yourself. Simply add the highlighted lines below, to the corresponding files in the template:
Then follow this when running flet build
.
@NHLOCAL, can you please be more precise? What permissions did you try to request? The above explanation might also apply to you.
I would like to add write permissions on folders, including:
I followed the instructions, but got the following error:
flet build apk core --template C:\Users\user\Documents\GitHub\flet-build-template --template-ref 0.23.1 --org nhlocal --company "NH Local" --copyright "© 2024 NH Local" --build-version 13.2.0 --build-number 13200 --splash-color #0E2B59 --splash-dark-color #FFC300 --project singlessorter
[08:53:26] Created Flutter bootstrap project from
C:\Users\משתמש\Documents\GitHub\flet-build-template with ref
0.23.1 ✅
Customized app icons and splash images ✅
[08:53:46] Generated app icons ✅
[08:53:53] Generated splash screens ✅
[08:56:45] Packaged Python app ✅
[09:01:31] Resolving dependencies...
collection 1.18.0 (1.19.0 available)
file_picker 8.0.5 (8.0.6 available)
fl_chart 0.65.0 (0.68.0 available)
flutter_lints 2.0.3 (4.0.0 available)
flutter_markdown 0.6.23 (0.7.3 available)
flutter_plugin_android_lifecycle 2.0.19 (2.0.20 available)
http_parser 4.0.2 (4.1.0 available)
intl 0.18.1 (0.19.0 available)
js 0.6.7 (0.7.1 available)
lints 2.1.1 (4.0.0 available)
material_color_utilities 0.8.0 (0.12.0 available)
meta 1.11.0 (1.15.0 available)
! package_info_plus 8.0.0 (overridden)
path_provider_android 2.2.4 (2.2.6 available)
sensors_plus 4.0.2 (5.0.1 available)
shared_preferences_android 2.2.2 (2.2.3 available)
url_launcher_android 6.3.2 (6.3.3 available)
! wakelock_plus 1.2.5 (overridden)
web_socket_channel 2.4.5 (3.0.0 available)
win32 5.5.0 (5.5.1 available)
Got dependencies!
18 packages have newer versions incompatible with dependency
constraints.
Try `flutter pub outdated` for more information.
Running Gradle task 'assembleRelease'...
Checking the license for package Android SDK Build-Tools 34 in
C:\Users\me\AppData\Local\Android\Sdk\licenses
License for package Android SDK Build-Tools 34 accepted.
Preparing "Install Android SDK Build-Tools 34 v.34.0.0".
"Install Android SDK Build-Tools 34 v.34.0.0" ready.
Installing Android SDK Build-Tools 34 in
C:\Users\me\AppData\Local\Android\Sdk\build-tools\34.0.0
"Install Android SDK Build-Tools 34 v.34.0.0" complete.
"Install Android SDK Build-Tools 34 v.34.0.0" finished.
Running Gradle task 'assembleRelease'...
283.2s
../../Pub/Cache/hosted/pub.dev/flet-0.23.2/lib/src/utils/borders.
dart:122:1: Error: Type 'WidgetStateBorderSide' not found.
WidgetStateBorderSide? parseWidgetStateBorderSide(
^^^^^^^^^^^^^^^^^^^^^
../../Pub/Cache/hosted/pub.dev/flet-0.23.2/lib/src/utils/borders.
dart:138:45: Error: Type 'WidgetStateBorderSide' not found.
class WidgetStateBorderSideFromJSON extends WidgetStateBorderSide
{
^^^^^^^^^^^^^^^^^^^^^
../../Pub/Cache/hosted/pub.dev/flet-0.23.2/lib/src/utils/borders.
dart:158:27: Error: Type 'WidgetState' not found.
BorderSide? resolve(Set<WidgetState> states) {
^^^^^^^^^^^
../../Pub/Cache/hosted/pub.dev/flet-0.23.2/lib/src/utils/colors.d
art:242:1: Error: Type 'WidgetStateProperty' not found.
WidgetStateProperty<Color?>? parseWidgetStateColor(
^^^^^^^^^^^^^^^^^^^
../../Pub/Cache/hosted/pub.dev/flet-0.23.2/lib/src/utils/icons.da
rt:17:1: Error: Type 'WidgetStateProperty' not found.
WidgetStateProperty<Icon?>? parseWidgetStateIcon(
^^^^^^^^^^^^^^^^^^^
../../Pub/Cache/hosted/pub.dev/flet-0.23.2/lib/src/utils/material
_state.dart:3:1: Error: Type 'WidgetStateProperty' not found.
WidgetStateProperty<T?>? getWidgetStateProperty<T>(
^^^^^^^^^^^^^^^^^^^
../../Pub/Cache/hosted/pub.dev/flet-0.23.2/lib/src/utils/material
_state.dart:16:38: Error: Type 'WidgetStateProperty' not found.
class WidgetStateFromJSON<T> extends WidgetStateProperty<T?> {
^^^^^^^^^^^^^^^^^^^
../../Pub/Cache/hosted/pub.dev/flet-0.23.2/lib/src/utils/material
_state.dart:34:18: Error: Type 'WidgetState' not found.
T? resolve(Set<WidgetState> states) {
^^^^^^^^^^^
../../Pub/Cache/hosted/pub.dev/flet-0.23.2/lib/src/utils/borders.
dart:158:27: Error: 'WidgetState' isn't a type.
BorderSide? resolve(Set<WidgetState> states) {
^^^^^^^^^^^
../../Pub/Cache/hosted/pub.dev/flet-0.23.2/lib/src/utils/colors.d
art:57:21: Error: The getter 'surfaceContainerHighest' isn't
defined for the class 'ColorScheme'.
- 'ColorScheme' is from
'package:flutter/src/material/color_scheme.dart'
('../../../../first-flet-app/flutter/packages/flutter/lib/src/mat
erial/color_scheme.dart').
Try correcting the name to the name of an existing getter, or
defining a getter or field named 'surfaceContainerHighest'.
return scheme.surfaceContainerHighest;
^^^^^^^^^^^^^^^^^^^^^^^
../../Pub/Cache/hosted/pub.dev/flet-0.23.2/lib/src/utils/material
_state.dart:34:18: Error: 'WidgetState' isn't a type.
T? resolve(Set<WidgetState> states) {
^^^^^^^^^^^
../../Pub/Cache/hosted/pub.dev/flet-0.23.2/lib/src/utils/theme.da
rt:205:5: Error: No named parameter with the name
'surfaceContainerHighest'.
surfaceContainerHighest: parseColor(null,
j["surface_variant"]),
^^^^^^^^^^^^^^^^^^^^^^^
../../Pub/Cache/hosted/pub.dev/flet-0.23.2/lib/src/controls/check
box.dart:117:7: Error: 'WidgetStateBorderSide' isn't a type.
WidgetStateBorderSide? side = parseWidgetStateBorderSide(
^^^^^^^^^^^^^^^^^^^^^
../../Pub/Cache/hosted/pub.dev/flet-0.23.2/lib/src/controls/cuper
tino_button.dart:126:33: Error: The getter 'WidgetState' isn't
defined for the class '_CupertinoButtonControlState'.
- '_CupertinoButtonControlState' is from
'package:flet/src/controls/cupertino_button.dart'
('../../Pub/Cache/hosted/pub.dev/flet-0.23.2/lib/src/controls/cup
ertino_button.dart').
Try correcting the name to the name of an existing getter, or
defining a getter or field named 'WidgetState'.
?.resolve(selected ? {WidgetState.selected} : {});
^^^^^^^^^^^
../../Pub/Cache/hosted/pub.dev/flet-0.23.2/lib/src/controls/cuper
tino_button.dart:131:33: Error: The getter 'WidgetState' isn't
defined for the class '_CupertinoButtonControlState'.
- '_CupertinoButtonControlState' is from
'package:flet/src/controls/cupertino_button.dart'
('../../Pub/Cache/hosted/pub.dev/flet-0.23.2/lib/src/controls/cup
ertino_button.dart').
Try correcting the name to the name of an existing getter, or
defining a getter or field named 'WidgetState'.
?.resolve(selected ? {WidgetState.selected} : {});
^^^^^^^^^^^
../../Pub/Cache/hosted/pub.dev/flet-0.23.2/lib/src/controls/list_
tile.dart:131:9: Error: No named parameter with the name
'minTileHeight'.
minTileHeight: control.attrDouble("minHeight"),
^^^^^^^^^^^^^
../../../../first-flet-app/flutter/packages/flutter/lib/src/mater
ial/list_tile.dart:332:9: Context: Found this candidate, but the
arguments don't match.
const ListTile({
^^^^^^^^
../../Pub/Cache/hosted/pub.dev/flet-0.23.2/lib/src/controls/highl
ight_view.dart:97:43: Error: The getter 'surfaceContainerHighest'
isn't defined for the class 'ColorScheme'.
- 'ColorScheme' is from
'package:flutter/src/material/color_scheme.dart'
('../../../../first-flet-app/flutter/packages/flutter/lib/src/mat
erial/color_scheme.dart').
Try correcting the name to the name of an existing getter, or
defining a getter or field named 'surfaceContainerHighest'.
Theme.of(context).colorScheme.surfaceContainerHighest
);
^^^^^^^^^^^^^^^^^^^^^^^
Target kernel_snapshot failed: Exception
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileFlutterBuildRelease'.
> Process 'command
'C:\Users\me\first-flet-app\flutter\bin\flutter.bat'' finished
with non-zero exit value 1
* 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 4m 41s
Gradle task assembleRelease failed with exit code 1
[09:01:32] Error building Flet app - see the log of failed command above.
Upgrade your flutter version to at least 3.22.2
Ah, @burhansvural, seems like you are trying to check/request the contacts permissions. It doesnt work certainly because the flet-build-template doesnt contain these permissions yet.
Why? What we were trying to avoid is to have all these permissions (contacts, camera, phone, calendar etc) in the build-template because not everyone will need, and it might also lead to rejection of apps when they are submitted to the stores: "why does your app needs all these permissions, though it seems like it doesn't makes use of all?"
In #3345 (subscribe to it), we could make everything dynamic: on could define from that file which permissions should be added to the build-template, so that only the required/used permissions are included.
However, you can download the flet-build-template and add these permissions to it yourself. Simply add the highlighted lines below, to the corresponding files in the template:
- https://github.com/Baseflow/flutter-permission-handler/blob/main/permission_handler_android/example/android/app/src/main/AndroidManifest.xml#L18-L21
- https://github.com/Baseflow/flutter-permission-handler/blob/main/permission_handler_android/example/android/app/src/profile/AndroidManifest.xml#L8-L11
Then follow this when running
flet build
.@NHLOCAL, can you please be more precise? What permissions did you try to request? The above explanation might also apply to you.
@ndonkoHenri Because I am now trying to make a WhatsApp-like application, which I had previously prepared with the Java programming language, with Python Flet, and these permissions are required. Also, your answer was very descriptive. Thank you.
Can you make a small video on how I can do this?
Question
Permission Request window don't open. Android CAT Error : No permissions found in manifest
Code sample
Error message