

```bash
sudo apt update && sudo apt upgrade -y

#安装必要的依赖
sudo apt install -y \
    build-essential \
    git \
    python3 \
    python3-pip \
    python3-venv \
    openjdk-17-jdk \
    unzip \
    zip \
    libffi-dev \
    libssl-dev \
    libsqlite3-dev \
    libjpeg-dev \
    libfreetype6-dev \
    libgl1-mesa-dev \
    libgles2-mesa-dev \
    zlib1g-dev \
    autoconf \
    automake \
    libtool \
    pkg-config \
    cmake \
    curl \
    lld \
    libncurses5

#创建虚拟环境 
python3 -m venv kivy_env
source kivy_env/bin/activate

#升级pip
pip install --upgrade pip setuptools wheel cython

#安装kivy
pip install "kivy[base]" kivy_examples
#检查是否安装成功
python -m kivy.examples.demo.touchtracer

#安装 Buildozer构建环境
pip install buildozer
#验证是否安装成功
buildozer --version

#初始化 buildozer 配置文件
buildozer init

#打包构建apk 开梯子！
buildozer android debug


```


```python
from kivy.app import App
from kivy.uix.label import Label

class MyApp(App):
    def build(self):
        return Label(text="Hello Android from Kivy!")

if __name__ == "__main__":
    MyApp().run()

```









