def start_test(request):
os.system('echo Starting emulator...')
os.system('./android-sdk-linux_x86/tools/emulator -avd testavd &')
return HttpResponse("OK")
Here is the barebones code of what I am trying to do.
When this code gets executed, the server stops responding while running the emulator. Any help appreciated.
I am using the django development server. Here is the server output:
Django version 1.1.1, using settings 'Cloust.settings'
Development server is running at http://0.0.0.0:8000/
Quit the server with CONTROL-C.
Starting emulator...
[21/Apr/2011 02:00:06] "GET /start_test/a.apk/ HTTP/1.1" 200 5
emulator: warning: opening audio output failed
emulator: emulator window was out of view and was recentred
Maybe you should try to run emulator in separate thread?
E.g.
import subprocess
thread = threading.Thread(target=subprocess.popen(['./android-sdk-linux_x86/tools/emulator', '-avd', 'testavd', '&'])
thread.start()
Considering you are using django you will probably need to manage the emulators somehow. Threading is not really a good option in this case I think.
I'd suggest looking into task management in this case with something like http://code.google.com/p/django-tasks/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With