<p>我已经成功地在ubuntu12.04 64位上构建了kivy提供的两个示例,并在我的nexus4设备上运行了这些示例,基本上遵循了<a href="http://python-for-android.readthedocs.org/en/latest/examples/#hello-world" rel="nofollow" title="python-for-android documentation websites">python-for-android websites </a>上给出的以下命令:</p>
<pre><code>./build.py --package org.test.touchtracer --name touchtracer --version 1.0 --dir /home/bernhard/Development/kivy/examples/demo/touchtracer debug
</code></pre>
<p>为了进一步的开发和必要的调试,我想在Android仿真器上测试我编译的python程序,因为将应用程序复制到设备上有点麻烦,而且需要相当长的时间来传输(如果您认为这不是真的,请纠正我-我还没有经验)。在</p>
<p>所以,我用androidsdkmanager[19.0.2]在一个模拟的nexus4设备上运行android4.4.2,创建了一个AVD。
当我启动模拟器时,会出现一个新的窗口,以闪亮的字体显示“android”,但其他的一切都没有发生,看起来像是一个冻结(模拟)的设备(即,我无法与模拟器交互)。AVD管理器将位于my~/.android/AVD中的AVD列为“有效的android虚拟设备”。我尝试过Intel Atom(x86)和armeabiv7a作为CPU,但什么都没有。
由于我找不到关于如何在模拟器上复制和测试python应用程序的良好说明,我尝试了以下天真的方法将debug选项从上面改为installd</p>
^{pr2}$
<p>但主要是这样:</p>
<pre><code>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
</code></pre>
<p>这是令人困惑的,因为模拟器正在运行。
有一次,我得到了一些更有希望的东西,但仍然没有改变模拟器的输出:</p>
<pre><code>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
</code></pre>
<p>或者:</p>
<pre><code>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
</code></pre>
<p>很抱歉,我对不同的输出如此不精确,我自己也不明白差异的原因。我认为这可能是因为在一次试用之前,真正的设备已经连接好了,或者我已经删除了python for android/dist/default/bin文件夹中的所有touchtracer*文件。
最后,我的问题是:</p>
<p>1)我是否正确地使用build命令在模拟器上安装编译的代码?在</p>
<p>2)为什么模拟器只显示一个闪亮的“android”字母而没有任何交互的可能性?在</p>
<p>3)你知道关于如何在Ubuntu上使用Android仿真器的好链接/教程吗?在</p>
<p>先谢谢你!
谨致问候,
伯恩哈德</p>