3

我在优胜美地,使用 buildozer 将其转换为 apk 时遇到错误。我已经更新了 Android sdk 中的所有内容。
编辑:我应该注意我只使用库“随机”和“kivy”,随机是标准库,所以我认为我不需要在 buildozer.spec 中指定它的使用,并且 kivy 已经在 buildozer.spec 中指定。
该代码还具有:

kivy.require('1.8.0')  

我正在编辑 buildozer.spec,方法是用正则表达式注释掉查找版本的部分,然后取消注释下面仅告诉使用版本“1.2”的部分。我想这可能是问题所在...

以下是将 buildozer.spec 设置为 loglevel=2 的相关输出:

hn:flappy subnetfile$ buildozer android debug
# Check configuration tokens
# Ensure build layout
# Check configuration tokens
# Preparing build
# Check requirements for android
# Search for Git (git)
#  -> found at /usr/bin/git
# Search for Cython (cython)
#  -> found at /Library/Frameworks/Python.framework/Versions/2.7/bin/cython
# Search for Java compiler (javac)
#  -> found at /System/Library/Frameworks/JavaVM.framework/Versions/A/Commands/javac
# Search for Java keytool (keytool)
#  -> found at /System/Library/Frameworks/JavaVM.framework/Versions/A/Commands/keytool
# Install platform
# Apache ANT found at /Users/subnetfile/.buildozer/android/platform/apache-ant-1.9.4
# Android SDK found at /Users/subnetfile/.buildozer/android/platform/android-sdk-21
# Android NDK found at /Users/subnetfile/.buildozer/android/platform/android-ndk-r9c
# Check application requirements
# Run './distribute.sh -l'
# Cwd /Users/subnetfile/Desktop/kivy-game-tutorial/flappy/.buildozer/android/platform/python-for-android
Available modules: android apsw audiostream bidi c_igraph cprotobuf cymunk django docutils enum34 ffmpeg freetype gevent greenlet harfbuzz hostpython igraph jpeg kivent_core kivent_cymunk kivy libevent libpq libswift libxml2 libxslt libyaml lxml m2crypto midistream msgpack mysql_connector netifaces numpy opencv openssl paramiko pil plyer png polygon protobuf psutil psycopg2 pyasn1 pycrypto pygame pyjnius pylibpd pyopenssl pyparsing pyqrcode python pyyaml sdl setuptools six sqlalchemy sqlite3 storm swift twisted txws wokkel zeroconf zope
# Application requirements already installed, pass
# Check garden requirements
# Compile platform
# Run './distribute.sh -l'
# Cwd /Users/subnetfile/Desktop/kivy-game-tutorial/flappy/.buildozer/android/platform/python-for-android
Available modules: android apsw audiostream bidi c_igraph cprotobuf cymunk django docutils enum34 ffmpeg freetype gevent greenlet harfbuzz hostpython igraph jpeg kivent_core kivent_cymunk kivy libevent libpq libswift libxml2 libxslt libyaml lxml m2crypto midistream msgpack mysql_connector netifaces numpy opencv openssl paramiko pil plyer png polygon protobuf psutil psycopg2 pyasn1 pycrypto pygame pyjnius pylibpd pyopenssl pyparsing pyqrcode python pyyaml sdl setuptools six sqlalchemy sqlite3 storm swift twisted txws wokkel zeroconf zope
# Distribution already compiled, pass.
# Build the application #2
# Copy application source from /Users/subnetfile/Desktop/kivy-game-tutorial/flappy
# Create directory /Users/subnetfile/Desktop/kivy-game-tutorial/flappy/.buildozer/android/app
# Copy /Users/subnetfile/Desktop/kivy-game-tutorial/flappy/flappy.kv
# Copy /Users/subnetfile/Desktop/kivy-game-tutorial/flappy/flappy.py
# Copy /Users/subnetfile/Desktop/kivy-game-tutorial/flappy/kivy_fix.py
# Copy /Users/subnetfile/Desktop/kivy-game-tutorial/flappy/kivyNotes.py
# Copy /Users/subnetfile/Desktop/kivy-game-tutorial/flappy/main.py
# Create directory /Users/subnetfile/Desktop/kivy-game-tutorial/flappy/.buildozer/android/app/images
# Copy /Users/subnetfile/Desktop/kivy-game-tutorial/flappy/images/background.png
# Copy /Users/subnetfile/Desktop/kivy-game-tutorial/flappy/images/bird.png
# Copy /Users/subnetfile/Desktop/kivy-game-tutorial/flappy/images/bird_anim.atlas
# Copy /Users/subnetfile/Desktop/kivy-game-tutorial/flappy/images/bird_anim.png
# Copy /Users/subnetfile/Desktop/kivy-game-tutorial/flappy/images/ground.png
# Copy /Users/subnetfile/Desktop/kivy-game-tutorial/flappy/images/pipe_bottom.png
# Copy /Users/subnetfile/Desktop/kivy-game-tutorial/flappy/images/pipe_top.png
# Create directory /Users/subnetfile/Desktop/kivy-game-tutorial/flappy/.buildozer/android/app/using-kv
# Copy /Users/subnetfile/Desktop/kivy-game-tutorial/flappy/using-kv/game.kv
# Copy /Users/subnetfile/Desktop/kivy-game-tutorial/flappy/using-kv/game.py
# Package the application
# project.properties updated
# Run '/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python build.py --name flappy --version 1.2.0 --package org.test.flappy --private /Users/subnetfile/Desktop/kivy-game-tutorial/flappy/.buildozer/android/app --sdk 14 --minsdk 8 --orientation landscape debug'
# Cwd /Users/subnetfile/Desktop/kivy-game-tutorial/flappy/.buildozer/android/platform/python-for-android/dist/flappy
Updated project.properties
Updated local.properties
----------
build.xml: Failed to find version-tag string. File must be updated.
In order to not erase potential customizations, the file will not be automatically regenerated.
If no changes have been made to the file, delete it manually and run the command again.
If you have made customizations to the build process, the file must be manually updated.
It is recommended to:
    * Copy current file to a safe location.
    * Delete original file.
    * Run command again to generate a new file.
    * Port customizations to the new file, by looking at the new rules file
      located at <SDK>/tools/ant/build.xml
    * Update file to contain
          version-tag: custom
      to prevent file from being rewritten automatically by the SDK tools.
----------
Updated file ./proguard-project.txt
It seems that there are sub-projects. If you want to update them
please use the --subprojects parameter.
Listing /Users/subnetfile/Desktop/kivy-game-tutorial/flappy/.buildozer/android/platform/python-for-android/dist/flappy/private ...  

-set-mode-check:

-set-debug-files:

-check-env:
 [checkenv] Android SDK Tools Revision 24.3.2
 [checkenv] Installed at /Users/subnetfile/.buildozer/android/platform/android-sdk-21

-setup:
     [echo] Project Name: flappy-1.2.0
  [gettype] Project Type: Application

-set-debug-mode:

-debug-obfuscation-check:

-pre-build:

-build-setup:
[getbuildtools] Using latest Build Tools: 23.0.0 rc2
     [echo] Resolving Build Target for flappy-1.2.0...
[gettarget] Project Target:   Android 4.0
[gettarget] API level:        14
     [echo] ----------
     [echo] Creating output directories if needed...
     [echo] ----------
     [echo] Resolving Dependencies for flappy-1.2.0...
[dependency] Library dependencies:
[dependency] No Libraries
[dependency] 
[dependency] ------------------
[dependency] API<=15: Adding annotations.jar to the classpath.
     [echo] ----------
     [echo] Building Libraries with 'debug'...
   [subant] No sub-builds to iterate on

-code-gen:
[mergemanifest] Found modified input file
[mergemanifest] Merging AndroidManifest files into one.
[mergemanifest] Manifest merger disabled. Using project manifest only.
     [echo] Handling aidl files...
     [aidl] Found 1 AIDL files.
     [aidl] Compiling 1 AIDL files.

BUILD FAILED
/Users/subnetfile/.buildozer/android/platform/android-sdk-21/tools/ant/build.xml:649: The following error occurred while executing this line:
/Users/subnetfile/.buildozer/android/platform/android-sdk-21/tools/ant/build.xml:655: Execute failed: java.io.IOException: Cannot run program "/Users/subnetfile/Desktop/kivy-game-tutorial/flappy/.buildozer/android/platform/python-for-android/dist/flappy/${aidl}": error=2, No such file or directory
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
    at java.lang.Runtime.exec(Runtime.java:620)
    at org.apache.tools.ant.taskdefs.launcher.Java13CommandLauncher.exec(Java13CommandLauncher.java:58)
    at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:428)
    at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:442)
    at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:628)
    at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:669)
    at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:495)
    at com.android.ant.AidlExecTask$AidlProcessor.process(AidlExecTask.java:102)
    at com.android.ant.MultiFilesTask.processFiles(MultiFilesTask.java:131)
    at com.android.ant.AidlExecTask.execute(AidlExecTask.java:203)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
    at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
    at com.android.ant.IfElseTask.execute(IfElseTask.java:120)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
    at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
    at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:396)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
    at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:435)
    at org.apache.tools.ant.Target.performTasks(Target.java:456)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
    at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
    at org.apache.tools.ant.Main.runBuild(Main.java:851)
    at org.apache.tools.ant.Main.startAnt(Main.java:235)
    at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
    at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Caused by: java.io.IOException: error=2, No such file or directory
    at java.lang.UNIXProcess.forkAndExec(Native Method)
    at java.lang.UNIXProcess.<init>(UNIXProcess.java:185)
    at java.lang.ProcessImpl.start(ProcessImpl.java:134)
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
    ... 48 more

Total time: 2 seconds
le/Desktop/kivy-game-tutorial/flappy/.buildozer/android/app/images/pipe_bottom.png
assets/private.mp3: /Users/subnetfile/Desktop/kivy-game-tutorial/flappy/.buildozer/android/app/images/pipe_top.png
assets/private.mp3: /Users/subnetfile/Desktop/kivy-game-tutorial/flappy/.buildozer/android/app/using-kv/game.kv
assets/private.mp3: /Users/subnetfile/Desktop/kivy-game-tutorial/flappy/.buildozer/android/app/using-kv/game.pyo
Traceback (most recent call last):
  File "build.py", line 508, in <module>
    make_package(args)
  File "build.py", line 357, in make_package
    subprocess.check_call([ANT, arg])
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 540, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['ant', 'debug']' returned non-zero exit status 1
# Command failed: /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python build.py --name flappy --version 1.2.0 --package org.test.flappy --private /Users/subnetfile/Desktop/kivy-game-tutorial/flappy/.buildozer/android/app --sdk 14 --minsdk 8 --orientation landscape debug
# 
# Buildozer failed to execute the last command
# The error might be hidden in the log above this error
# Please read the full log, and search for it before
# raising an issue with buildozer itself.
# In case of a bug report, please add a full log with log_level = 2
4

0 回答 0