我已經成功地建立由kivy在Ubuntu 12.04提供了兩個例子,64位和運行這些我的Nexus 4設備上使用此命令後基本上就python-for-android websites給予以下說明:如何使用android模擬器(使用Ubuntu 12.04 + kivy)測試我的python應用程序?
./build.py --package org.test.touchtracer --name touchtracer --version 1.0 --dir /home/bernhard/Development/kivy/examples/demo/touchtracer debug
對於進一步發展和必要的調試,我想在Android模擬器上測試我編譯的Python程序,因爲將應用程序複製到設備上有點麻煩&需要相當長的時間來傳輸,我認爲(如果您認爲這是不是真的 - 我還沒有經驗)。
因此,我在模擬的Nexus 4設備上創建了一個運行Android 4.4.2的Android SDK管理器[19.0.2]。 當我啓動模擬器時出現一個新的窗口,顯示'android'閃亮的字體,但沒有其他事情發生,似乎是一個凍結(模擬)設備(即我無法與模擬器交互)。 AVD管理器列出位於我的〜/ .android/avd中的這個AVD爲「有效的Android虛擬設備」。我已經嘗試了英特爾凌動(x86)和ARM armeabiv7a作爲CPU,但沒有。 因爲我無法找到如何在模擬器上覆制&測試我的Python應用程序很好的說明,我已經試過天真以下從上面改變了調試選項INSTALLD
./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模擬器的好鏈接/教程嗎?
非常感謝提前! 祝好, 伯恩哈德
感謝您提示「使用主機GPU」 - 這會加速很多事情,現在仿真器出現了。不過,來自kivy的「touchtracer」演示程序沒有運行。我需要研究如何現在調試。當然,提示非常受歡迎!但是現在非常感謝你! – bkaplan
確保你正在運行build命令而不是installd – brousch