Skip to content

Error on windows10 apk build from demo app ( Deletion failed, OS Error: Access is denied. ) #3848

Closed
@Buggist

Description

@Buggist

Duplicate Check

Describe the bug

Just trying to build the demo app created by command "flet create . " to apk, and it was failed.

Code sample

Code
import flet as ft


def main(page: ft.Page):
    page.add(ft.SafeArea(ft.Text("Hello, Flet!")))


ft.app(main)

To reproduce

(312-flet023-test) C:\Users\kg\Desktop\fletty>flet build apk --verbose

[10:20:51] Flutter bootstrap directory: C:\Users\kg\AppData\Local\Temp\flet_flutter_build_bEl3t76syP
Additional Flutter dependencies:
{}
[10:20:54] Created Flutter bootstrap project from gh:flet-dev/flet-build-template with ref 0.23.2 ✅
Copying C:\Users\kg\Desktop\fletty\assets\icon.ico to
C:\Users\kg\AppData\Local\Temp\flet_flutter_build_bEl3t76syP\images
Customized app icons and splash images ✅
Run subprocess: ['C:\Programming\flutter\bin\dart.BAT', 'run', 'flutter_launcher_icons']
( ● ) Generating app icons ⏳... Resolving dependencies in C:\Users\kg\AppData\Local\Temp\flet_flutter_build_bEl3t7( ● ) Generating app icons (4.5s) Downloading packages... ( ● ) Generating app icons ⏳... Got dependencies in C:\Users\kg\AppData\Local\Temp\flet_flutter_build_bEl3t76syP`.
( ● ) Generating app icons ⏳...
Built flutter_launcher_icons:flutter_launcher_icons.
( ● ) Generating app icons ⏳... ════════════════════════════════════════════
FLUTTER LAUNCHER ICONS (v0.13.1)
════════════════════════════════════════════

( ● ) Generating app icons ⏳... • Creating default icons Android
• Overwriting the default Android launcher icon with a new icon
( ●) Generating app icons ⏳... • Overwriting default iOS launcher icon with new icon
( ● ) Generating app icons ⏳... Creating Icons for Web...
( ●) Generating app icons ⏳... Creating Icons for Windows...
( ● ) Generating app icons ⏳... Creating Icons for MacOS...
( ● ) Generating app icons ⏳...
✓ Successfully generated launcher icons
[10:21:07] Generated app icons ✅
Run subprocess: ['C:\Programming\flutter\bin\dart.BAT', 'run', 'flutter_native_splash:create']
( ● ) Generating splash screens ⏳...
Built flutter_native_splash:create.
( ● ) Generating splash screens ⏳... [Android] Creating default splash images
( ● ) Generating splash screens ⏳... [Android] Creating dark mode splash images
[Android] Creating default android12splash images
[Android] Creating dark mode android12splash images
( ● ) Generating splash screens ⏳... [Android] Updating launch background(s) with splash image path...
[Android] - android/app/src/main/res/drawable/launch_background.xml
[Android] - android/app/src/main/res/drawable-night/launch_background.xml
[Android] - android/app/src/main/res/drawable-v21/launch_background.xml
[Android] - android/app/src/main/res/drawable-night-v21/launch_background.xml
[Android] Updating styles...
[Android] - android/app/src/main/res/values-v31/styles.xml
[Android] No android/app/src/main/res/values-v31/styles.xml found in your Android project
[Android] Creating android/app/src/main/res/values-v31/styles.xml and adding it to your Android project
[Android] - android/app/src/main/res/values-night-v31/styles.xml
[Android] No android/app/src/main/res/values-night-v31/styles.xml found in your Android project
[Android] Creating android/app/src/main/res/values-night-v31/styles.xml and adding it to your Android project
( ● ) Generating splash screens ⏳... [Android] - android/app/src/main/res/values/styles.xml
[Android] - android/app/src/main/res/values-night/styles.xml
[iOS] Creating images
[iOS] Creating dark mode images
[iOS] Updating ios/Runner/Info.plist for status bar hidden/visible
[Web] Creating images
[Web] Creating images
[Web] Creating background images
[Web] Creating CSS
( ● ) Generating splash screens ⏳... [Web] Updating index.html

✅ Native splash complete.
Now go finish building something awesome! 💪 You rock! 🤘🤩
Like the package? Please give it a 👍 here: https://pub.dev/packages/flutter_native_splash

[10:21:10] Generated splash screens ✅
Run subprocess: ['C:\Programming\flutter\bin\dart.BAT', 'run', 'serious_python:main', 'package',
'C:\Users\kg\Desktop\fletty', '--mobile', '--platform', 'mobile', '--dep-mappings', 'flet=flet-embed',
'--req-deps', 'flet-embed', '--exclude', 'build']
(● ) Packaging Python app ⏳...
Built serious_python:main.
(● ) Packaging Python app ⏳... Running package command
Creating asset directory: C:\Users\kg\AppData\Local\Temp\flet_flutter_build_bEl3t76syP\app
Copying Python app from C:\Users\kg\Desktop\fletty to C:\Users\kg\AppData\Local\Temp\serious_python_tempb5b5b217
( ●) Packaging Python app ⏳... Configured mobile platform with sitecustomize.py at C:\Users\kg\AppData\Local\Temp\serious_python_sitecustomizedf99ffbe\sitecustomize.py
Installing dependencies [flet-embed==0.22.*] with pip command to C:\Users\kg\AppData\Local\Temp\serious_python_tempb5b5b217_pypackages_
Extracting Python distributive from C:\Users\kg\AppData\Local\Temp\cpython-3.11.6+20231002-x86_64-pc-windows-msvc-shared-install_only.tar.gz to C:\Users\kg\AppData\Local\Temp\hostpython3.11_4586fc97
( ● ) Packaging Python app ⏳... Compiling Python sources at C:\Users\kg\AppData\Local\Temp\serious_python_tempb5b5b217
( ● ) Packaging Python app ⏳... Error: FormatException: Unexpected extension byte (at offset 3147)
Deleting temp directory C:\Users\kg\AppData\Local\Temp\serious_python_tempb5b5b217
( ● ) Packaging Python app ⏳... Deleting sitecustomize directory C:\Users\kg\AppData\Local\Temp\serious_python_sitecustomizedf99ffbe
Deleting Python directory C:\Users\kg\AppData\Local\Temp\hostpython3.11_4586fc97
Unhandled exception:
PathAccessException: Deletion failed, path = 'C:\Users\kg\AppData\Local\Temp\hostpython3.11_4586fc97' (OS Error: Access is denied.
, errno = 5)
#0 _checkForErrorResponse (dart:io/common.dart:55:9)
#1 _Directory._delete. (dart:io/directory_impl.dart:180:7)

#2 PackageCommand.run (file:///C:/Users/kg/AppData/Local/Pub/Cache/hosted/pub.dev/serious_python-0.7.1/bin/package_command.dart:363:9)

#3 CommandRunner.runCommand (package:args/command_runner.dart:212:13)

#4 main (file:///C:/Users/kg/AppData/Local/Pub/Cache/hosted/pub.dev/serious_python-0.7.1/bin/main.dart:10:3)

[10:21:28] Deleting Flutter bootstrap directory C:\Users\kg\AppData\Local\Temp\flet_flutter_build_bEl3t76syP
Error building Flet app - see the log of failed command above.

Expected behavior

The build process should be success.

Screenshots / Videos

Captures

[Upload media here]

![example](https://github.com/user-attachments/assets/5d7b829e-5fc4-453e-875c-abd91d308823)

Operating System

Windows

Operating system details

Windows 10 Pro Version 22H2

Flet version

both happend in 0.23.2 and 0.22.1 with same issue

Regression

No, it isn't

Suggestions

Not a clue.

Logs

Logs
[Paste your logs here]

Additional details

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions