ich Android SDK
auf Ubuntu 16.04 installiert haben, die auf meinem Laptop auf Virtual Box läuft. Ich habe ein Samsung Galaxy Tab an den Laptop angeschlossen. Das Gerät ist für die virtuelle Maschine zugänglich. Ich versuche, meinen android app (apk file
) mit monkeyrunner zu installieren.Monkeyrunner auf Ubuntu 16.04 installieren android apk-Datei
Das Python-Skript, das ich verwende, ist unter
# Imports the monkeyrunner modules used by this program
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
# Connects to the current device, returning a MonkeyDevice object
device = MonkeyRunner.waitForConnection()
# Installs the Android package. Notice that this method returns a boolean, so you can test
# to see if the installation worked.
device.installPackage('myproject/bin/MyApplication.apk')
# sets a variable with the package's internal name
package = 'com.example.android.myapplication'
# sets a variable with the name of an Activity in the package
activity = 'com.example.android.myapplication.MainActivity'
# sets the name of the component to start
runComponent = package + '/' + activity
# Runs the component
device.startActivity(component=runComponent)
# Presses the Menu button
device.press('KEYCODE_MENU', MonkeyDevice.DOWN_AND_UP)
# Takes a screenshot
result = device.takeSnapshot()
# Writes the screenshot to a file
result.writeToFile('myproject/shot1.png','png')
ich das Skript als
monkeyrunner -v ALL ~/Workspace/monkey_runner_sample.py
Ich betreibe erhalten die folgende Ausgabe und nichts passiert. Das Programm hängt ab.
170209 11:19:27.878:I [main] [com.android.chimpchat.ChimpManager] Monkey Command: wake.
170209 11:19:31.146:S [pool-1-thread-1] [com.android.chimpchat.adb.AdbChimpDevice] Error starting command: monkey --port 12345
170209 11:19:31.146:S [pool-1-thread-1] [com.android.chimpchat.adb.AdbChimpDevice]com.android.ddmlib.TimeoutException
170209 11:19:31.146:S [pool-1-thread-1] [com.android.chimpchat.adb.AdbChimpDevice] at com.android.ddmlib.AdbHelper.read(AdbHelper.java:766)
170209 11:19:31.146:S [pool-1-thread-1] [com.android.chimpchat.adb.AdbChimpDevice] at com.android.ddmlib.AdbHelper.read(AdbHelper.java:735)
170209 11:19:31.146:S [pool-1-thread-1] [com.android.chimpchat.adb.AdbChimpDevice] at com.android.ddmlib.AdbHelper.readAdbResponse(AdbHelper.java:221)
170209 11:19:31.146:S [pool-1-thread-1] [com.android.chimpchat.adb.AdbChimpDevice] at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:455)
170209 11:19:31.146:S [pool-1-thread-1] [com.android.chimpchat.adb.AdbChimpDevice] at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:381)
170209 11:19:31.146:S [pool-1-thread-1] [com.android.chimpchat.adb.AdbChimpDevice] at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:352)
170209 11:19:31.146:S [pool-1-thread-1] [com.android.chimpchat.adb.AdbChimpDevice] at com.android.ddmlib.Device.executeShellCommand(Device.java:604)
170209 11:19:31.146:S [pool-1-thread-1] [com.android.chimpchat.adb.AdbChimpDevice] at com.android.chimpchat.adb.AdbChimpDevice$1.run(AdbChimpDevice.java:105)
170209 11:19:31.146:S [pool-1-thread-1] [com.android.chimpchat.adb.AdbChimpDevice] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
170209 11:19:31.146:S [pool-1-thread-1] [com.android.chimpchat.adb.AdbChimpDevice] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
170209 11:19:31.146:S [pool-1-thread-1] [com.android.chimpchat.adb.AdbChimpDevice] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
170209 11:19:31.146:S [pool-1-thread-1] [com.android.chimpchat.adb.AdbChimpDevice] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
170209 11:19:31.146:S [pool-1-thread-1] [com.android.chimpchat.adb.AdbChimpDevice] at java.lang.Thread.run(Thread.java:745)
Die Anwendung MyApplication
ist nicht auf dem Tablet installiert zu werden.
Die Fehler werden unter
170209 11:27:07.692:S [pool-1-thread-1] [com.android.chimpchat.adb.AdbChimpDevice] Error starting command: monkey --port 12345
170209 11:27:07.692:S [pool-1-thread-1] [com.android.chimpchat.adb.AdbChimpDevice]com.android.ddmlib.TimeoutException
gegeben
Könnte mir herauszufinden, jemand helfen, was geschieht?
Arbeitete wie ein Charme :) danke. – liv2hak
Großartig. Es gibt viel mehr Dinge, die AndroidViewClient/culebra tun kann [im Vergleich zu monkeyrunner] (http://dtmilano.blogspot.com/2015/12/androidviewclientculebra-vs-monkeyrunner.html), wie die Unterstützung von [Mehrgerätetests] (http: //dtmilano.blogspot.com/2015/05/android-culebra-multi-device.html), Erzeugen von Tests unter Verwendung von GUI, [harmonika] (http://dtmilano.blogspot.com/2015/08/culebra-concertina- mode.html) und [dekorieren screenshots] (http://dtmilano.blogspot.com/2015/04/android-betenting-beautiful-screenshots.html) unter anderem. –
Ich fange an, das zu versuchen. Könnten Sie bitte einen Blick auf http://stackoverflow.com/questions/42149499/pressing-buttons-by-text-on-android-app-using-culebra nehmen, wenn Sie eine Chance bekommen. – liv2hak