资料
- https://learn.microsoft.com/en-us/windows/wsl/install
- 视频教程:2022-1001-Convert Python to Android with WINDOWS & LINUX.mp4 YouTube 阿里云盘
- Win10自带ubuntu的安装和使用 - 马谦的博客 https://www.dyxmq.cn/other/windows/win10-ubuntu.html
操作步骤
-
管理员身份运行 PowerShell
-
PowerShell 输入
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
-
PowerShell 输入
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
-
下载 linux-kernel
https://learn.microsoft.com/en-us/windows/wsl/install-manual#step-4—download-the-linux-kernel-update-package -
安装 linux-kernel
-
PowerShell 输入
wsl --set-default-version 2
-
Store 安装 ubuntu
-
PowerShell 输入下面命令,选择是,重启Windows系统
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
-
开始菜单—打开ubuntu—输入新的账户与密码【ddx ******】
-
拷贝 kivy-demo
-
ubuntu 安装pip (费时)
sudo apt-get update sudo apt-get upgrade sudo apt install python3-pip
-
ubuntu 安装 buildozer docs
pip3 install --user --upgrade buildozer sudo apt install -y git zip unzip openjdk-17-jdk python3-pip autoconf libtool pkg-config zlib1g-dev libncurses5-dev libncursesw5-dev libtinfo5 cmake libffi-dev libssl-dev pip3 install --user --upgrade Cython==0.29.19 virtualenv export PATH=$PATH:~/.local/bin/
-
ubuntu 安装 adb
sudo apt install adb adb --version
-
下载 SDK. Version:For Windows https://developer.android.com/studio/releases/platform-tools 【好像没用到】
-
ubuntu shell
buildozer init buildozer -v android debug
-
卡到此处,这也该也是最后一步
-
直接输入 buildozer -v android debug 出现 fatal: could not create work tree dir ‘python-for-android’: Permission denied,已知 buildozer.spec 文件中的p4a仓库有问题,但是修改为仓库为kivy还是报上述错误
-
先 pip install python-for-android 再 p4a apk,出现 Build failed: Asked to compile for no Archs, so failing
-
过程中的问题
-
PermissionError: [Errno 13] Permission denied: ‘/home/ddx/Kivy_Android/.buildozer/applibs’
解决方法:将项目移动到Ubuntu目录下
-
当输入 buildozer -v android debug 会出现 fatal: could not create work tree dir ‘python-for-android’: Permission denied
解决方法:未解决
-
当输入 p4a apk 会出现 [ERROR]: Build failed: Asked to compile for no Archs, so failing
解决方法:未解决