You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

执行flet build apk命令无法生成APK文件的问题求助

执行flet build apk命令无法生成APK文件的问题求助

我用Python做了一个简单的Flet应用,现在想把它打包成APK文件在安卓设备上运行,但折腾了半天,在build目录里根本找不到.apk文件,实在没辙了来求助大家!

之前看了几个用flet build apk命令打包APK的教程视频,别人打包后的目录结构都是这样的:

project_root
└─── build
    └─── apk
        └─── release.apk

但我执行完同样的命令后,生成的目录结构完全不一样(内容比较多,如果需要的话我可以附截图):

project_root
└─── build
    └─── flutter
    |     └─── android
    |          └─── app
    |          └─── ...
    |
    └─── site-packages
    └─── arm64-v8a (这个目录是空的)

我翻遍了所有子目录,都没找到.apk文件的踪影。

下面是我执行flet build apk命令后的完整输出,其中有个错误我感觉是关键问题:

Created Flutter bootstrap project from gh:flet-dev/flet-build-template with ref 0.25.1 ✅                                                                                                                                                                                                           
           Customized app icons and splash images ✅                                                                                                                                                                                                                                                           
[22:46:13] Generated app icons ✅                                                                                                                                                                                                                                                                              
[22:46:18] Generated splash screens ✅                                                                                                                                                                                                                                                                         
[22:46:50] Running package command                                                                                                                                                                                                                                                                             
           Extra PyPi indexes:                                                                                                                                                                                                                                                                                 
           Creating asset directory: C:\Users\username\Desktop\Code\Python\Tests\MyApp\build\flutter\app                                                                                                                                                                                                     
           Created temp directory: C:\Users\username\AppData\Local\Temp\serious_python_temp2448bdf8                                                                                                                                                                                                               
           Copying Python app from C:\Users\username\Desktop\Code\Python\Tests\MyApp to a temp directory                                                                                                                                                                                                     
           Cleanup app                                                                                                                                                                                                                                                                                         
           Configured Android/arm64-v8a platform with sitecustomize.py                                                                                                                                                                                                                                         
           Installing [-r, C:\Users\username\Desktop\Code\Python\Tests\MyApp\requirements.txt] with pip command to C:\Users\username\Desktop\Code\Python\Tests\MyApp\build\site-packages\arm64-v8a                                                                                                         
           Downloading Python distributive from https://github.com/indygreg/python-build-standalone/releases/download/20240909/cpython-3.12.6+20240909-x86_64-pc-windows-msvc-shared-install_only_stripped.tar.gz to a build directory                                                                         
           Extracting Python distributive                                                                                                                                                                                                                                                                      
                                                                                                                                                                                                                                                                                                               
           ERROR: Could not find a version that satisfies the requirement flet-desktop==0.25.1 (from versions: none)                                                                                                                                                                                           
           ERROR: No matching distribution found for flet-desktop==0.25.1                                                                                                                                                                                                                                      
                                                                                                                                                                                                                                                                                                               
           Error building Flet app - see the log of failed command above.                                                                                                                                                                                                                                      
[22:46:55] Doctor summary (to see all details, run flutter doctor -v):                                                                                                                                                                                                                                         
           [√] Flutter (Channel stable, 3.24.5, on Microsoft Windows [Version 10.0.26100.2314], locale en-US)                                                                                                                                                                                                  
           [√] Windows Version (Installed version of Windows is version 10 or higher)                                                                                                                                                                                                                          
           [√] Windows Version (Installed version of Windows is version 10 or higher)                                                                                                                                                                                                                          
           [!] Android toolchain - develop for Android devices (Android SDK version 34.0.0)                                                                                                                                                                                                                    
               ! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses                                                                                                                                                                                                   
           [X] Chrome - develop for the web (Cannot find Chrome executable at .\Google\Chrome\Application\chrome.exe)                                                                                                                                                                                          
               ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.                                                                                                                                                                                                                     
           [√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.12.0)                                                                                                                                                                                                                     
           [√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.12.0)                                                                                                                                                                                                                     
           [!] Android Studio (not installed)

我注意到输出里明确提示找不到满足要求的flet-desktop==0.25.1版本,会不会是这个依赖问题导致打包过程中断,最终没生成APK?另外我的Android许可证还没接受,也没安装Android Studio,这些因素会不会也影响APK的生成?希望有经验的朋友能帮我分析下问题出在哪,怎么解决。

备注:内容来源于stack exchange,提问作者João Amgarten

火山引擎 最新活动