Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
1 task done
Buggist opened this issue Aug 23, 2024 · 10 comments
Open
1 task done
Labels
status: awaiting response Further information is requested

Comments

@Buggist
Copy link

Buggist commented Aug 23, 2024

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

@ndonkoHenri
Copy link
Collaborator

ndonkoHenri commented Aug 23, 2024

Created Flutter bootstrap project from gh:flet-dev/flet-build-template with ref 0.23.2 ✅
.....
Installing dependencies [flet-embed==0.22.*]

Can you share your requirements file and the output of flutter doctor?

@ndonkoHenri ndonkoHenri added the status: awaiting response Further information is requested label Aug 23, 2024
@Buggist
Copy link
Author

Buggist commented Aug 24, 2024

Created Flutter bootstrap project from gh:flet-dev/flet-build-template with ref 0.23.2 ✅
.....
Installing dependencies [flet-embed==0.22.*]

Can you share your requirements file and the output of flutter doctor?

requirements.txt

flet==0.22.*

@Buggist
Copy link
Author

Buggist commented Aug 24, 2024

flutter doctor

C:\Users\kg\Desktop>flutter doctor

┌─────────────────────────────────────────────────────────┐
│ A new version of Flutter is available! │
│ │
│ To update to the latest version, run "flutter upgrade". │
└─────────────────────────────────────────────────────────┘
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.22.3, on Microsoft Windows [版本 10.0.19045.4651], locale zh-CN)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[!] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
X cmdline-tools component is missing
Run path/to/sdkmanager --install "cmdline-tools;latest"
See https://developer.android.com/studio/command-line for more details.
X Android license status unknown.
Run flutter doctor --android-licenses to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.
[√] Chrome - develop for the web
[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.10.5)
[√] Android Studio (version 2024.1)
[√] Connected device (3 available)
[√] Network resources

! Doctor found issues in 1 category.

Created Flutter bootstrap project from gh:flet-dev/flet-build-template with ref 0.23.2 ✅
.....
Installing dependencies [flet-embed==0.22.*]

Can you share your requirements file and the output of flutter doctor?

flutter doctor

C:\Users\kg\Desktop>flutter doctor

┌─────────────────────────────────────────────────────────┐
│ A new version of Flutter is available! │
│ │
│ To update to the latest version, run "flutter upgrade". │
└─────────────────────────────────────────────────────────┘
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.22.3, on Microsoft Windows [版本 10.0.19045.4651], locale zh-CN)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[!] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
X cmdline-tools component is missing
Run path/to/sdkmanager --install "cmdline-tools;latest"
See https://developer.android.com/studio/command-line for more details.
X Android license status unknown.
Run flutter doctor --android-licenses to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.
[√] Chrome - develop for the web
[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.10.5)
[√] Android Studio (version 2024.1)
[√] Connected device (3 available)
[√] Network resources

! Doctor found issues in 1 category.

@Buggist
Copy link
Author

Buggist commented Aug 24, 2024

Created Flutter bootstrap project from gh:flet-dev/flet-build-template with ref 0.23.2 ✅
.....
Installing dependencies [flet-embed==0.22.*]

Can you share your requirements file and the output of flutter doctor?

Thank you for reply, now I already fixed all issues showed on flutter doctor, but it is no help with my condition of build error.

flutter doctor

C:\Users\kg\Desktop>flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.22.3, on Microsoft Windows [Version 10.0.19045.4651], locale en-US)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
[√] Chrome - develop for the web
[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.10.5)
[√] Android Studio (version 2024.1)
[√] Connected device (3 available)
[√] Network resources

• No issues found!

@tanmay-bhatgare
Copy link

@Buggist, I’ve noticed that the packaging process takes an unusually long time and displays the message, "Packaging Python files," when running flet build apk on a local machine. However, this issue does not occur when executed on a virtual machine. I recommend checking this discussion if you are still experiencing packaging errors.

@ByteJoseph
Copy link

@Buggist, I’ve noticed that the packaging process takes an unusually long time and displays the message, "Packaging Python files," when running flet build apk on a local machine. However, this issue does not occur when executed on a virtual machine. I recommend checking this discussion if you are still experiencing packaging errors.

I have same issue. How to use virtual machine ?

@tanmay-bhatgare
Copy link

tanmay-bhatgare commented Sep 6, 2024

@ByteJoseph in my previous reply I have mentioned a discussion see that, I have already told entire process step by step just follow it and you're good to go.

@ByteJoseph
Copy link

@ByteJoseph in my previous reply I have mentioned a discussion see that, I have already told entire process step by step just follow it and you're good to go.

Thanks

@ByteJoseph
Copy link

ByteJoseph commented Sep 8, 2024

Have you turned on developer mode?
My issue is solved. It takes about 15 to 20 minutes to build the APK on my Windows 10 computer

@Buggist
Copy link
Author

Buggist commented Sep 9, 2024

Have you turned on developer mode? My issue is solved. It takes about 15 to 20 minutes to build the APK on my Windows 10 computer

Yes I have.
I finally find out a work flow to deal with this building issue, but tortuous, and the building process is still not stable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: awaiting response Further information is requested
Projects
None yet
Development

No branches or pull requests

5 participants
@Buggist @ndonkoHenri @ByteJoseph @tanmay-bhatgare and others