【发布时间】:2014-03-26 22:53:09
【问题描述】:
我已经设法在 Ubuntu 12.04 64 位上构建了 kivy 提供的两个示例,并在我的 Nexus 4 设备上运行这些示例,基本上遵循python-for-android websites 上给出的这些说明,使用此命令:
./build.py --package org.test.touchtracer --name touchtracer --version 1.0 --dir /home/bernhard/Development/kivy/examples/demo/touchtracer debug
为了进一步开发和必要的调试,我想在 Android 模拟器上测试我编译的 python 程序,因为将应用程序复制到设备有点麻烦并且需要很长时间才能传输,我认为(请更正如果您认为这不是真的,请告诉我——我还没有经验)。
因此,我使用 Android SDK Manager [19.0.2] 在模拟的 Nexus 4 设备上运行 Android 4.4.2 创建了一个 AVD。 当我启动模拟器时,会出现一个新窗口,以闪亮的字体显示“android”,但没有其他任何反应,似乎是一个冻结(模拟)设备(即我无法与模拟器交互)。 AVD 管理器将此位于我的 ~/.android/avd 中的 AVD 列为“有效的 Android 虚拟设备”。我已经尝试将 Intel Atom (x86) 和 ARM armeabiv7a 作为 CPU,但没有。 由于我找不到关于如何在模拟器上复制和测试我的 python 应用程序的良好说明,我尝试了以下天真地将调试选项从上面更改为已安装
./build.py --package org.test.touchtracer --name touchtracer --version 1.0 --dir /home/bernhard/Development/kivy/examples/demo/touchtracer installd
但大多数情况下我都明白:
install:
[echo] Installing /home/bernhard/Development/python-for-android/dist/default/bin/touchtracer-1.0-debug.apk onto default emulator or device...
[exec] error: device not found
[exec] - waiting for device -
[exec] rm failed for /data/local/tmp/touchtracer-1.0-debug.apk, No such file or directory
BUILD FAILED
/home/bernhard/Development/android-sdk-linux/tools/ant/build.xml:1364: The following error occurred while executing this line:
/home/bernhard/Development/android-sdk-linux/tools/ant/build.xml:1378: exec returned: 1
Total time: 51 seconds
Traceback (most recent call last):
File "./build.py", line 412, in <module>
make_package(args)
File "./build.py", line 336, in make_package
subprocess.check_call([ANT, arg])
File "/usr/lib/python2.7/subprocess.py", line 511, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['ant', 'installd']' returned non-zero exit status 1
这是令人困惑的,因为模拟器正在运行。 一旦我得到了更有希望的东西,它仍然没有改变模拟器输出:
install:
[echo] Installing /home/bernhard/Development/python-for-android/dist/default/bin/touchtracer-1.0-debug.apk onto default emulator or device...
[exec] 979 KB/s (6559511 bytes in 6.542s)
[exec] WARNING: linker: libdvm.so has text relocations. This is wasting memory and is a security risk. Please fix.
[exec] Error: Could not access the Package Manager. Is the system running?
installd:
BUILD SUCCESSFUL
或:
install:
[echo] Installing /home/bernhard/Development/python-for-android/dist/default/bin/touchtracer-1.0-debug.apk onto default emulator or device...
[exec] 988 KB/s (6559511 bytes in 6.482s)
[exec] WARNING: linker: libdvm.so has text relocations. This is wasting memory and is a security risk. Please fix.
[exec] pkg: /data/local/tmp/touchtracer-1.0-debug.apk
[exec] - waiting for device -
[exec] rm failed for /data/local/tmp/touchtracer-1.0-debug.apk, No such file or directory
很抱歉,我对不同的输出如此不精确,我自己也不明白造成这些差异的原因。我认为这可能与真实设备在一次试用之前连接的事实有关,或者我已经删除了我的 python-for-android/dist/default/bin 文件夹中的所有 touchtracer* 文件。 所以,最后我的问题:
1) 我是否正确使用 build 命令在模拟器上安装编译后的代码?
2) 为什么模拟器只显示闪亮的“android”字样而没有任何交互的可能性?
3) 你知道任何关于如何在 Ubuntu 上使用 Android 模拟器的好链接/教程吗?
提前非常感谢! 最好的祝福, 伯恩哈德
【问题讨论】:
标签: android python ubuntu android-emulator kivy