问题描述:

I have installed Eclipse, pyDev, and Kivy and setup my first project with a main.py file using the instructions found here:

http://www.ocularsoftware.com/2012/11/how-to-use-pydev-to-develop-and-run-kivy-applications-on-windows/

But I'm now stuck on how to create a Hello World Android app and install it on my Android emulator.

Do I need to import any part of the Android SDK? Am I missing anything? I don't even know what to put in my main.py except

print("Hello, World!")

EDIT: Ok I figured out how to get it to run in a test window, but I still can't get it to run in an Android virtual device.

Here is the new code:

from kivy.app import App

from kivy.uix.button import Button

class TestApp(App):

def build(self):

return Button(text='Hello World')

if __name__ in ('__main__', '__android__'):

TestApp().run()

Thanks

网友答案:

The tutorial that you linked to does not have anything to do with Android.

The title is:

How to use PyDev to develop and run Kivy Applications (on Windows)

note the (on windows) part.

So that I don't think is going to get you anywhere.

It is possible to write python apps for android. See here: https://code.google.com/p/python-for-android/

and here: http://code.google.com/p/android-scripting/

I don't think kivy is going to work on sl4a though. I do believe that they have some support for GUI applications, but it is not nearly as thorough as the java SDK.

网友答案:

Running the kivy apps on the android virtual machine is not supported. You need to use a actual device. for details look here.

The easiest way for now on windows is to::

  1. Download the pre-built VM(ubuntu 12.10 warning 930+MB), it's a virtualbox disk
  2. Create a new VirtualBox VM that uses this disk
  3. Start the vm and follow the instructions mentioned on the Readme on the desktop of the VM.

You should have a apk ready shortly.

相关阅读:
Top