def __init__(self, project_dir, config, module_project): super(android, self).__init__(project_dir, config, module_project) self.sdk = androidsdk.AndroidSDK(module_project.sdk) if self.sdk.get_platform_dir() == None: print "[ERROR] Couldn't find the Android API r%s platform directory" % self.sdk.DEFAULT_API_LEVEL sys.exit(1) if self.sdk.get_google_apis_dir() == None: print "[ERROR] Couldn't find the Google APIs r%s add-on directory" % self.sdk.DEFAULT_API_LEVEL sys.exit(1) self.init_classpath()
if no_devices: sys.exit(1) return False print "[DEBUG] Device connected... (waited %d seconds)" % (attempts * 5) duration = time.time() - t print "[DEBUG] waited %f seconds on emulator to get ready" % duration if duration > 1.0: print "[INFO] Waiting for the Android Emulator to become available" time.sleep(hard_timeout) # give it a little more time to get installed if __name__ == "__main__": if len(sys.argv) == 1: print 'Usage: %s <path/to/android-sdk> (device|emulator)' % sys.argv[0] sys.exit(-1) sdk = androidsdk.AndroidSDK(sys.argv[1], 4) hard_timeout = 20 type = "e" if len(sys.argv) > 2: if sys.argv[2] == "device": type = "d" if len(sys.argv) > 3: hard_timeout = int(sys.argv[3]) wait_for_device(sdk, type, hard_timeout)
#!/usr/bin/env python # Kill a running Android JDWP (debuggable) process without Eclipse import os, sys, traceback, androidsdk if len(sys.argv) < 4: print >>sys.stderr, "Usage: %s <android_sdk> <device_id> <app_id>" % sys.argv[0] sys.exit(1) android_sdk = sys.argv[1] device_id = sys.argv[2] app_id = sys.argv[3] sdk = androidsdk.AndroidSDK(android_sdk, 4) try: sdk.jdwp_kill(app_id, adb_args=['-s', device_id]) except Exception, e: print >>sys.stderr, 'Error killing App %s on Device %s' % (app_id, device_id) traceback.print_exc()