如何在 Ubuntu 上安装 Buildozer 以创建 Kivy 应用的 Android APK?

How do I install Buildozer on Ubuntu to create an Android APK of a Kivy App?(如何在 Ubuntu 上安装 Buildozer 以创建 Kivy 应用的 Android APK?)
本文介绍了如何在 Ubuntu 上安装 Buildozer 以创建 Kivy 应用的 Android APK?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

在 Ubuntu 13.10 上安装 buildozer 并不容易.我多次重新安装了 Ubuntu,现在我想分享一下我是如何安装 buildozer 的.

It's not easy to install buildozer on Ubuntu 13.10. I reinstalled Ubuntu several times and now I'd like to share how I installed buildozer.

我从 buildozer 收到以下错误:

I got the following errors from buildozer:

  1. ./distribute.sh not found --> no fix found(这就是我重新安装Ubuntu两次的原因,可能是python安装的问题,但我不确定)
  2. _add_java_src() 失败 --> 添加正确的 Java JDK 路径修复它

推荐答案

下面描述的过程对我来说非常有效:

我已在 Windows 7(64 位)主机系统的虚拟机(VMware 播放器)中全新安装 Ubuntu 13.10(32 位).

The procedure described below was working perfectly for me:

I've installed it in a fresh installation of Ubuntu 13.10 (32bit) inside a virtual machine (VMware player) in Windows 7 (64bit) host system.

我决定使用 32 位,因为 VM 使用的 RAM 不多,并且不需要 64 位系统.但 64 位 Ubuntu 可能也可以工作(未经测试).我将 VMWare 文件的 zip 存档上传到谷歌驱动器(root 用户亚历山大在 ubuntu 中的密码是 UbuntuBuildozer)

I decided to use 32 bit because the VM uses not that much RAM and a 64bit system is not needed. But 64bit Ubuntu will probably also work (not tested). I uploaded the zip archive of the VMWare files to google drive (password in ubuntu for root user alexander is UbuntuBuildozer)

您可以在此处找到压缩文件:https://drive.google.com/file/d/0B5m9_RVHCpL-YmxPVnVaYWZyZ2s/edit?usp=sharing

You can find the zip-file here: https://drive.google.com/file/d/0B5m9_RVHCpL-YmxPVnVaYWZyZ2s/edit?usp=sharing

  1. 安装 Python-Kivy (http://kivy.org/docs/installation/installation-linux.html#ubuntu-11-10-or-newer) 与

$ sudo add-apt-repository ppa:kivy-team/kivy

$ sudo add-apt-repository ppa:kivy-team/kivy

$ sudo apt-get 更新

$ sudo apt-get update

$ sudo apt-get install python-kivy

$ sudo apt-get install python-kivy

  • 如果你还没有安装 pip:

  • install pip, if you haven't got it:

    $ sudo apt-get install python-pip python-dev build-essential

    $ sudo apt-get install python-pip python-dev build-essential

  • 构建器的先决条件:需要 zlib、Git、Cython 和 JDK

  • prerequisites for buildozer: zlib, Git, Cython and JDK is required

    $ sudo apt-get install zlib1g-dev git-core cython openjdk-7-jdk

    $ sudo apt-get install zlib1g-dev git-core cython openjdk-7-jdk

    安装 Java JDK 指南(http://tecadmin.net/install-java-jdk-ubuntu/#)

    install Java JDK guide (http://tecadmin.net/install-java-jdk-ubuntu/#)

    安装 buildozer(https://github.com/kivy/buildozer)

    install buildozer (https://github.com/kivy/buildozer)

    $ sudo pip install buildozer

    $ sudo pip install buildozer

  • 初始化 buildozer 并开始调试(只是为了安装 Andriod SDK、NDK 和 ANT - 还不需要 main.py,这需要几分钟):

  • initialize buildozer and start with debug (just to install Andriod SDK, NDK & ANT - no main.py needed yet, this takes several minutes):

    $ buildozer 初始化

    $ buildozer init

    $ buildozer android 调试

    $ buildozer android debug

  • 如果 buildozer 在 _add_java_src() 处失败:在/home/yourusername/.bashrc 中添加 JDK 路径 - 在末尾添加这些行(重要的是使用 1.x JDK 而不是 java-7 路径):

  • If buildozer fails at _add_java_src(): Add JDK path in /home/yourusername/.bashrc - add these lines at the end (important use 1.x JDK and not java-7 path):

    导出 PATH=$PATH:/usr/lib/jvm/java-1.6.0-openjdk-i386/bin

    export PATH=$PATH:/usr/lib/jvm/java-1.6.0-openjdk-i386/bin

    导出 JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk-i386

    export JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk-i386

  • 现在转到您的应用程序 main.py 并执行以下命令:

  • Now go to your apps main.py and do the following commands:

    $ buildozer 初始化

    $ buildozer init

    (编辑 buildozer.spec 并更改您的应用名称并检查第 28/29 行或第 32 行的版本控制 --> 取决于您的 main.py 代码
    请参阅对 Buildozer 编译简单的 android kivy 应用程序的回答,但是打包失败)

    (edit buildozer.spec and change your app name and check the versioning on line 28/29 or line 32 --> depends on your main.py code
    see SO answer to Buildozer compiles simple android kivy application, but fails while packaging)

    $ buildozer android debug deploy 运行

    $ buildozer android debug deploy run

  • 这篇关于如何在 Ubuntu 上安装 Buildozer 以创建 Kivy 应用的 Android APK?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

    本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

    相关文档推荐

    How can I use CClistview in COCOS2d Android?(如何在 COCOS2d Android 中使用 CClistview?)
    cocos2d-android: how to display score(cocos2d-android:如何显示分数)
    Sqlite database not copied from asset folder Android(Sqlite 数据库未从资产文件夹 Android 复制)
    SQLite Database Copy Appears Corrupted When Generated by Device and not Emulator(SQLite 数据库副本在由设备而不是模拟器生成时出现损坏)
    Android file copy(安卓文件拷贝)
    Android how to detect Copy event of Edittext in android(Android如何在android中检测Edittext的Copy事件)