I got the average setup for starting an app on a device and sometimes it works perfectly fine (the app starts and can be controlled by selendroid) sometimes (in the case of the firefox.apk) this happens:
Aug 10, 2015 3:02:13 PM io.selendroid.standalone.io.ShellCommand exec
INFORMATION: Executing shell command: C:\Users\Dustin Altermann\AppData\Local\Android\sdk\platform-tools\adb.exe -s BX903DKMSR shell am instrument -e main_activity -e server_port 8080 io.selendroid.org.mozilla.firefox/io.selendroid.server.ServerInstrumentation
Aug 10, 2015 3:02:13 PM io.selendroid.standalone.io.ShellCommand exec
INFORMATION: Shell command output
-->
usage: am [subcommand] [options]
usage: am start [-D] [-W] [-P ] [--start-profiler ]
[--R COUNT] [-S] [--opengl-trace]
am startservice
am force-stop
am kill
am kill-all
am broadcast
am instrument [-r] [-e ] [-p ] [-w]
[--no-window-animation]
am profile start
am profile stop []
am dumpheap [flags]
am set-debug-app [-w] [--persistent]
am clear-debug-app
am monitor [--gdb ]
am screen-compat [on|off]
am display-size [reset|MxN]
am to-uri [INTENT]
am to-intent-uri [INTENT]
am start: start an Activity. Options are:
-D: enable debugging
-W: wait for launch to complete
--start-profiler : start profiler and send results to
-P : like above, but profiling stops when app goes idle
-R: repeat the activity launch times. Prior to each repeat,
the top activity will be finished.
-S: force stop the target app before starting the activity
--opengl-trace: enable tracing of OpenGL functions
am startservice: start a Service.
am force-stop: force stop everything associated with .
am kill: Kill all processes associated with . Only kills.
processes that are safe to kill -- that is, will not impact the user experience.
am kill-all: Kill all background processes.
am broadcast: send a broadcast Intent.
am instrument: start an Instrumentation. Typically this target is the form /. Options are:
-r: print raw results (otherwise decode REPORT_KEY_STREAMRESULT). Use with
[-e perf true] to generate raw output for performance measurements.
-e : set argument to . For test runners a
common form is [-e [,...]].
-p : write profiling data to
-w: wait for instrumentation to finish before returning. Required for test runners.
--no-window-animation: turn off window animations will running.
am profile: start and stop profiler on a process.
am dumpheap: dump the heap of a process. Options are:
-n: dump native heap instead of managed heap
am set-debug-app: set application to debug. Options are:
-w: wait for debugger when application starts
--persistent: retain this value
am clear-debug-app: clear the previously set-debug-app.
am monitor: start monitoring for crashes or ANRs.
--gdb: start gdbserv on the given port at crash/ANR
am screen-compat: control screen compatibility mode of .
am display-size: override display size.
am to-uri: print the given Intent specification as a URI.
am to-intent-uri: print the given Intent specification as an intent: URI.
specifications include these flags and arguments:
[-a ] [-d ] [-t ]
[-c [-c ] ...]
[-e|--es ...]
[--esn ...]
[--ez ...]
[--ei ...]
[--el ...]
[--ef ...]
[--eu ...]
[--ecn ]
[--eia [, [--ela [, [--efa [, [-n ] [-f ]
[--grant-read-uri-permission] [--grant-write-uri-permission]
[--debug-log-resolution] [--exclude-stopped-packages]
[--include-stopped-packages]
[--activity-brought-to-front] [--activity-clear-top]
[--activity-clear-when-task-reset] [--activity-exclude-from-recents]
[--activity-launched-from-history] [--activity-multiple-task]
[--activity-no-animation] [--activity-no-history]
[--activity-no-user-action] [--activity-previous-is-top]
[--activity-reorder-to-front] [--activity-reset-task-if-needed]
[--activity-single-top] [--activity-clear-task]
[--activity-task-on-home]
[--receiver-registered-only] [--receiver-replace-pending]
[--selector]
[ | | ]
Error: Bad component name: server_port
<--
Aug 10, 2015 3:02:13 PM io.selendroid.standalone.io.ShellCommand exec
INFORMATION: Executing shell command: C:\Users\Dustin Altermann\AppData\Local\Android\sdk\platform-tools\adb.exe -s BX903DKMSR forward tcp:8080 tcp:8080
Aug 10, 2015 3:02:13 PM io.selendroid.standalone.io.ShellCommand exec
INFORMATION: Shell command output
-->
<--
Aug 10, 2015 3:02:13 PM io.selendroid.standalone.android.impl.AbstractDevice startLogging
INFORMATION: starting logcat:
Aug 10, 2015 3:02:13 PM io.selendroid.standalone.server.model.SelendroidStandaloneDriver waitForServerStart
INFORMATION: Waiting for the Selendroid server to start.
Aug 10, 2015 3:02:13 PM io.selendroid.standalone.android.impl.AbstractDevice isSelendroidRunning
INFORMATION: Checking if the Selendroid server is running: http://localhost:8080/wd/hub/status
Aug 10, 2015 3:02:13 PM org.apache.http.impl.execchain.RetryExec execute
INFORMATION: I/O exception (java.net.SocketException) caught when processing request to {}->http://localhost:8080: Connection reset
Aug 10, 2015 3:02:13 PM org.apache.http.impl.execchain.RetryExec execute
INFORMATION: Retrying request to {}->http://localhost:8080
Aug 10, 2015 3:02:13 PM org.apache.http.impl.execchain.RetryExec execute
INFORMATION: I/O exception (java.net.SocketException) caught when processing request to {}->http://localhost:8080: Connection reset
Aug 10, 2015 3:02:13 PM org.apache.http.impl.execchain.RetryExec execute
INFORMATION: Retrying request to {}->http://localhost:8080
Aug 10, 2015 3:02:13 PM org.apache.http.impl.execchain.RetryExec execute
INFORMATION: I/O exception (java.net.SocketException) caught when processing request to {}->http://localhost:8080: Connection reset
Aug 10, 2015 3:02:13 PM org.apache.http.impl.execchain.RetryExec execute
INFORMATION: Retrying request to {}->http://localhost:8080
Aug 10, 2015 3:02:13 PM io.selendroid.standalone.android.impl.AbstractDevice isSelendroidRunning
INFORMATION: Can't connect to Selendroid server, assuming it is not running.
The app doesn't start and selendroid keeps trying but nothing happens. I can start the app manually without any problems.
I don't understand the difference or what to do to narrow down the problem.
BTW.: I used the firefox.apk from the Google Play Store if anyone wants to try themselves.
Ok I finally did it:
The problem was that this particular app had an AndroidManifest.xml file (read it by using e.g. https://code.google.com/p/xml-apk-parser/) using the tag "activity-alias". Inside this tag there were the fields that Selendroid needs to determine the so called "main_activity":
<activity-alias android:label="Firefox" android:name=".App" android:targetActivity="org.mozilla.gecko.BrowserApp">
<intent-filter android:priority="999">
<action android:name="android.intent.action.MAIN">
</action>
<category android:name="android.intent.category.LAUNCHER">
</category>
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER">
</category>
<category android:name="android.intent.category.DEFAULT">
</category>
</intent-filter>
Unfortunately Selendroid doesn't understand this tag and therefore cant find the "main_activity".
Solution: I had to use the "SelendroidCapabilities.setLaunchActivity"-method to specifically tell Selendroid what activity to use:
SelendroidCapabilities caps = new SelendroidCapabilities("org.mozilla.firefox:39.0");
caps.setLaunchActivity("org.mozilla.gecko.BrowserApp");
Related
System: ubuntu 18.04
environment:VirtualBox
The first time I compiled the AOSP source code on Ubuntu 18.04, it passed, and the second time I compiled it failed.
Here is an error message.
[ 10% 538/4980] Ensuring Jack server is installed and started
FAILED: setup-jack-server
/bin/bash -c "(prebuilts/sdk/tools/jack-admin install-server prebuilts/sdk/tools/jack-launcher.jar prebuilts/sdk/tools/jack-server-4.11.ALPHA.jar 2>&1 || (exit 0) ) && (JACK_SERVER_VM_ARGUMENTS=\"-Dfile.encoding=UTF-8 -XX:+TieredCompilation\" prebuilts/sdk/tools/jack-admin start-server 2>&1 || exit 0 ) && (prebuilts/sdk/tools/jack-admin update server prebuilts/sdk/tools/jack-server-4.11.ALPHA.jar 4.11.ALPHA 2>&1 || exit 0 ) && (prebuilts/sdk/tools/jack-admin update jack prebuilts/sdk/tools/jacks/jack-4.32.CANDIDATE.jar 4.32.CANDIDATE || exit 47 )"
Jack server already installed in "/home/user/.jack-server"
Communication error with Jack server (35), try 'jack-diagnose' or see Jack server log
SSL error when connecting to the Jack server. Try 'jack-diagnose'
SSL error when connecting to the Jack server. Try 'jack-diagnose'
[ 10% 541/4980] build out/target/product/rk3399_mid/obj/ETC/precompiled_sepolicy_intermediates/precompiled_sepolicy
ninja: build stopped: subcommand failed.
22:32:18 ninja failed with: exit status 1
#### failed to build some targets (01:11 (mm:ss)) ####
Build android failed!
Generate error reports
/prebuilts/sdk/tools/report/18577$ unzip jack-report.18557.zip
Archive: jack-report.18557.zip
inflating: report.18557.txt
inflating: launcher.jar
inflating: config.properties
creating: logs/
inflating: logs/outputs.txt
inflating: logs/jack-server-0-2.log
inflating: logs/jack-server-1-0.log
inflating: logs/jack-server-0-0.log
extracting: logs/jack-server-0-0.log.lck
inflating: logs/jack-server-0-1.log
inflating: server-1.jar
creating: jack/
report.18557.txt :
ps -o "pid args" | grep com.android.jack.launcher.ServerLauncher | grep -v grep | awk '{print dump-report}' | xargs kill -3
$ id -u
1000
$ ps -A -o "uid pid args" | grep com.android.jack.launcher.ServerLauncher | grep -v grep
1000 6708 java -XX:MaxJavaStackTraceDepth=-1 -Djava.io.tmpdir=/tmp -Dfile.encoding=UTF-8 -XX:+TieredCompilation -cp /home/zhangying/.jack-server/launcher.jar com.android.jack.launcher.ServerLauncher
$ lsof -i TCP:8376 -l
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
java 6708 1000 21u IPv6 58493 0t0 TCP localhost:8376 (LISTEN)
$ lsof -i TCP:8377 -l
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
java 6708 1000 23u IPv6 58499 0t0 TCP localhost:8377 (LISTEN)
$ cat "$JACK_CLIENT_SETTING"
# Server settings
SERVER_HOST=localhost
SERVER_PORT_SERVICE=8376
SERVER_PORT_ADMIN=8377
# Internal, do not touch
SETTING_VERSION=4
$ cd "$JACK_HOME"; ls -l -R -n .
.:
total 10412
-rw------- 1 1000 1000 2097 May 2 10:04 client.jks
-rw------- 1 1000 1000 2814 May 2 21:48 client.pem
-rw------- 1 1000 1000 356 May 2 10:12 config.properties
drwxr-xr-x 2 1000 1000 4096 May 2 10:04 jack
-rw------- 1 1000 1000 5102506 May 2 10:04 launcher.jar
drwx------ 2 1000 1000 4096 May 2 21:48 logs
-rw------- 1 1000 1000 982 May 2 22:39 report.18557.txt
-rw------- 1 1000 1000 5522186 May 2 10:04 server-1.jar
-rw------- 1 1000 1000 2066 May 2 10:04 server.jks
-rw------- 1 1000 1000 1042 May 2 21:48 server.pem
./jack:
total 0
./logs:
total 32
-rw-r--r-- 1 1000 1000 689 May 2 22:03 jack-server-0-0.log
-rw-r--r-- 1 1000 1000 0 May 2 10:20 jack-server-0-0.log.lck
-rw-r--r-- 1 1000 1000 585 May 2 10:23 jack-server-0-1.log
-rw-r--r-- 1 1000 1000 689 May 2 10:19 jack-server-0-2.log
-rw-r--r-- 1 1000 1000 585 May 2 10:16 jack-server-1-0.log
-rw------- 1 1000 1000 13411 May 2 22:39 outputs.txt
$ curl --version
curl 7.58.0 (x86_64-pc-linux-gnu) libcurl/7.58.0 OpenSSL/1.1.1 zlib/1.2.11 libidn2/2.0.4 libpsl/0.19.1 (+libidn2/2.0.4) nghttp2/1.30.0 librtmp/2.3
Release-Date: 2018-01-24
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz TLS-SRP HTTP2 UnixSockets HTTPS-proxy PSL
$ JACK_EXTRA_CURL_OPTIONS=-v jack-admin list server
* Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 8377 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: /home/zhangying/.jack-server/server.pem
CApath: /etc/ssl/certs
} [5 bytes data]
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
} [512 bytes data]
* OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to localhost:8377
* Closing connection 0
SSL error when connecting to the Jack server. Try 'jack-diagnose'
$ jack-admin server-stat
Getting statistic from background server
SSL error when connecting to the Jack server. Try 'jack-diagnose'
$ base64 --version
base64 (GNU coreutils) 8.28
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Simon Josefsson.
$ (echo amFjaw==;echo LXNlcnZlcg==) | base64 --decode
I get the same error when I switch to Ubuntu 16.04.Below is a list of the installed Curl versions of Ubuntu 18.04.
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
curl/bionic-updates,bionic-security,now 7.58.0-2ubuntu3.13 amd64 [installed]
libcurl3-gnutls/bionic-updates,bionic-security,now 7.58.0-2ubuntu3.13 amd64 [installed,automatic]
libcurl4/bionic-updates,bionic-security,now 7.58.0-2ubuntu3.13 amd64 [installed,automatic]
libcurl4-openssl-dev/bionic-updates,bionic-security,now 7.58.0-2ubuntu3.13 amd64 [installed]
I have tried many ways, but I can't solve it. Please help me,thanks.
After the two steps below were applied, the AOSP was successfully built.
Remove TLSv1, TLSv1.1 from jdk.tls.disabledAlgorithms in /etc/java-8-openjdk/security/java.security file
Restart the jack server:
cd /prebuilts/sdk/tools/
./jack-admin kill-server
./jack-admin start-server
I just found the answer, see the link below
enter link description here
Change the code to this,
from /etc/java-8-openjdk/security/java.security remove TLSv1, TLSv1.1.
jdk.tls.disabledAlgorithms=SSLv3, RC4, DES, MD5withRSA,
DH keySize < 1024, EC keySize < 224, 3DES_EDE_CBC, anon, NULL,
include jdk.disabled.namedCurves
I just want to give all the different ways to solve the problem.
There are few ways to overcome this problem, one may work for someone -
Try to simply restart the jack server by below command at your android root folder
./prebuilts/sdk/tools/jack-admin kill-server
./prebuilts/sdk/tools/jack-admin start-server
Try to reduce the number of concurrent services in file $HOME/.jack-server/config.properties
Code:
jack.server.max-service=4
Try to make this value 2 or 1.
If jack server is not running or it hangs when try to run. Than try removing TLSv1, TLSv1.1 from rom /etc/java-8-openjdk/security/java.security
Solution 3 Worked for me.
A way to fix that in your Dockerfile :
USER root
# Fix jack server SSL issue during build
RUN perl -0777 -i -p -e 's/(jdk.tls.disabledAlgorithms=.*?), TLSv1, TLSv1\.1/$1/g' \
/etc/java-8-openjdk/security/java.security
Sometimes (not all times) when I try to push (simply run) the code the from android-studio to my phone (Motorola 3G, though not phone specific), I am getting this error :-
04/22 23:00:14: Launching app
No local changes, not deploying APK
$ adb shell am start -n "com.xxxx.test/com.horntell.test.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Error while executing: am start -n "com.horntell.test/com.horntell.test.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.horntell.test/.MainActivity }
usage: am [subcommand] [options]
usage: am start [-D] [-W] [-P <FILE>] [--start-profiler <FILE>]
[--sampling INTERVAL] [-R COUNT] [-S] [--opengl-trace]
[--user <USER_ID> | current] <INTENT>
am startservice [--user <USER_ID> | current] <INTENT>
am stopservice [--user <USER_ID> | current] <INTENT>
am force-stop [--user <USER_ID> | all | current] <PACKAGE>
am kill [--user <USER_ID> | all | current] <PACKAGE>
am kill-all
am broadcast [--user <USER_ID> | all | current] <INTENT>
am instrument [-r] [-e <NAME> <VALUE>] [-p <FILE>] [-w]
[--user <USER_ID> | current]
[--no-window-animation] [--abi <ABI>] <COMPONENT>
am profile start [--user <USER_ID> current] [--sampling INTERVAL] <PROCESS> <FILE>
am profile stop [--user <USER_ID> current] [<PROCESS>]
am dumpheap [--user <USER_ID> current] [-n] <PROCESS> <FILE>
am set-debug-app [-w] [--persistent] <PACKAGE>
am clear-debug-app
am set-watch-heap <PROCESS> <MEM-LIMIT>
am clear-watch-heap
am monitor [--gdb <port>]
am hang [--allow-restart]
am restart
am idle-maintenance
am screen-compat [on|off] <PACKAGE>
am package-importance <PACKAGE>
am to-uri [INTENT]
am to-intent-uri [INTENT]
am to-app-uri [INTENT]
am switch-user <USER_ID>
am start-user <USER_ID>
am stop-user [-w] <USER_ID>
am stack start <DISPLAY_ID> <INTENT>
am stack movetask <TASK_ID> <STACK_ID> [true|false]
am stack resize <STACK_ID> <LEFT,TOP,RIGHT,BOTTOM>
am stack split <STACK_ID> <v|h> [INTENT]
am stack list
am stack info <STACK_ID>
am task lock <TASK_ID>
am task lock stop
am task resizeable <TASK_ID> [true|false]
am task resize <TASK_ID> <LEFT,TOP,RIGHT,BOTTOM>
am get-config
am set-inactive [--user <USER_ID>] <PACKAGE> true|false
am get-inactive [--user <USER_ID>] <PACKAGE>
am send-trim-memory [--user <USER_ID>] <PROCESS>
[HIDDEN|RUNNING_MODERATE|BACKGROUND|RUNNING_LOW|MODERATE|RUNNING_CRITICAL|COMPLETE]
am start: start an Activity. Options are:
-D: enable debugging
-W: wait for launch to complete
--start-profiler <FILE>: start profiler and send results to <FILE>
--sampling INTERVAL: use sample profiling with INTERVAL microseconds
between samples (use with --start-profiler)
-P <FILE>: like above, but profiling stops when app goes idle
-R: repeat the activity launch <COUNT> times. Prior to each repeat,
the top activity will be finished.
-S: force stop the target app before starting the activity
--opengl-trace: enable tracing of OpenGL functions
--user <USER_ID> | current: Specify which user to run as; if not
specified then run as the current user.
am startservice: start a Service. Options are:
--user <USER_ID> | current: Specify which user to run as; if not
specified then run as the current user.
am stopservice: stop a Service. Options are:
--user <USER_ID> | current: Specify which user to run as; if not
specified then run as the current user.
am force-stop: force stop everything associated with <PACKAGE>.
--user <USER_ID> | all | current: Specify user to force stop;
all users if not specified.
am kill: Kill all processes associated with <PACKAGE>. Only kills.
processes that are safe to kill -- that is, will not impact the user
experience.
--user <USER_ID> | all | current: Specify user whose processes to kill;
all users if not specified.
am kill-all: Kill all background processes.
am broadcast: send a broadcast Intent. Options are:
--user <USER_ID> | all | current: Specify which user to send to; if not
specified then send to all users.
--receiver-permission <PERMISSION>: Require receiver to hold permission.
am instrument: start an Instrumentation. Typically this target <COMPONENT>
is the form <TEST_PACKAGE>/<RUNNER_CLASS>. Options are:
-r: print raw results (otherwise decode REPORT_KEY_STREAMRESULT). Use with
[-e perf true] to generate raw output for performance measurements.
-e <NAME> <VALUE>: set argument <NAME> to <VALUE>. For test runners a
common form is [-e <testrunner_flag> <value>[,<value>...]].
-p <FILE>: write profiling data to <FILE>
-w: wait for instrumentation to finish before returning. Required for
test runners.
--user <USER_ID> | current: Specify user instrumentation runs in;
current user if not specified.
--no-window-animation: turn off window animations while running.
--abi <ABI>: Launch the instrumented process with the selected ABI.
This assumes that the process supports the selected ABI.
am profile: start and stop profiler on a process. The given <PROCESS> argument
may be either a process name or pid. Options are:
--user <USER_ID> | current: When supplying a process name,
specify user of process to profile; uses current user if not specified.
am dumpheap: dump the heap of a process. The given <PROCESS> argument may
be either a process name or pid. Options are:
-n: dump native heap instead of managed heap
--user <USER_ID> | current: When supplying a process name,
specify user of process to dump; uses current user if not specified.
am set-debug-app: set application <PACKAGE> to debug. Options are:
-w: wait for debugger when application starts
--persistent: retain this value
am clear-debug-app: clear the previously set-debug-app.
am set-watch-heap: start monitoring pss size of <PROCESS>, if it is at or
above <HEAP-LIMIT> then a heap dump is collected for the user to report
am clear-watch-heap: clear the previously set-watch-heap.
am bug-report: request bug report generation; will launch UI
when done to select where it should be delivered.
am monitor: start monitoring for crashes or ANRs.
--gdb: start gdbserv on the given port at crash/ANR
am hang: hang the system.
--allow-restart: allow watchdog to perform normal system restart
am restart: restart the user-space system.
am idle-maintenance: perform idle maintenance now.
am screen-compat: control screen compatibility mode of <PACKAGE>.
am package-importance: print current importance of <PACKAGE>.
am to-uri: print the given Intent specification as a URI.
am to-intent-uri: print the given Intent specification as an intent: URI.
am to-app-uri: print the given Intent specification as an android-app: URI.
am switch-user: switch to put USER_ID in the foreground, starting
execution of that user if it is currently stopped.
am start-user: start USER_ID in background if it is currently stopped,
use switch-user if you want to start the user in foreground.
am stop-user: stop execution of USER_ID, not allowing it to run any
code until a later explicit start or switch to it.
-w: wait for stop-user to complete.
am stack start: start a new activity on <DISPLAY_ID> using <INTENT>.
am stack movetask: move <TASK_ID> from its current stack to the top (true) or bottom (false) of <STACK_ID>.
am stack resize: change <STACK_ID> size and position to <LEFT,TOP,RIGHT,BOTTOM>.
am stack split: split <STACK_ID> into 2 stacks <v>ertically or <h>orizontally
starting the new stack with [INTENT] if specified. If [INTENT] isn't
specified and the current stack has more than one task, then the top task
of the current task will be moved to the new stack. Command will also force
all current tasks in both stacks to be resizeable.
am stack list: list all of the activity stacks and their sizes.
am stack info: display the information about activity stack <STACK_ID>.
am task lock: bring <TASK_ID> to the front and don't allow other tasks to run.
am task lock stop: end the current task lock.
am task resizeable: change if <TASK_ID> is resizeable (true) or not (false).
am task resize: makes sure <TASK_ID> is in a stack with the specified bounds.
Forces the task to be resizeable and creates a stack if no existing stack
has the specified bounds.
am get-config: retrieve the configuration and any recent configurations
of the device.
am set-inactive: sets the inactive state of an app.
am get-inactive: returns the inactive state of an app.
am send-trim-memory: Send a memory trim event to a <PROCESS>.
<INTENT> specifications include these flags and arguments:
[-a <ACTION>] [-d <DATA_URI>] [-t <MIME_TYPE>]
[-c <CATEGORY> [-c <CATEGORY>] ...]
[-e|--es <EXTRA_KEY> <EXTRA_STRING_VALUE> ...]
[--esn <EXTRA_KEY> ...]
[--ez <EXTRA_KEY> <EXTRA_BOOLEAN_VALUE> ...]
[--ei <EXTRA_KEY> <EXTRA_INT_VALUE> ...]
[--el <EXTRA_KEY> <EXTRA_LONG_VALUE> ...]
[--ef <EXTRA_KEY> <EXTRA_FLOAT_VALUE> ...]
[--eu <EXTRA_KEY> <EXTRA_URI_VALUE> ...]
[--ecn <EXTRA_KEY> <EXTRA_COMPONENT_NAME_VALUE>]
[--eia <EXTRA_KEY> <EXTRA_INT_VALUE>[,<EXTRA_INT_VALUE...]]
(mutiple extras passed as Integer[])
[--eial <EXTRA_KEY> <EXTRA_INT_VALUE>[,<EXTRA_INT_VALUE...]]
(mutiple extras passed as List<Integer>)
[--ela <EXTRA_KEY> <EXTRA_LONG_VALUE>[,<EXTRA_LONG_VALUE...]]
(mutiple extras passed as Long[])
[--elal <EXTRA_KEY> <EXTRA_LONG_VALUE>[,<EXTRA_LONG_VALUE...]]
(mutiple extras passed as List<Long>)
[--efa <EXTRA_KEY> <EXTRA_FLOAT_VALUE>[,<EXTRA_FLOAT_VALUE...]]
(mutiple extras passed as Float[])
[--efal <EXTRA_KEY> <EXTRA_FLOAT_VALUE>[,<EXTRA_FLOAT_VALUE...]]
(mutiple extras passed as List<Float>)
[--esa <EXTRA_KEY> <EXTRA_STRING_VALUE>[,<EXTRA_STRING_VALUE...]]
(mutiple extras passed as String[]; to embed a comma into a string,
escape it using "\,")
[--esal <EXTRA_KEY> <EXTRA_STRING_VALUE>[,<EXTRA_STRING_VALUE...]]
(mutiple extras passed as List<String>; to embed a comma into a string,
escape it using "\,")
[--grant-read-uri-permission] [--grant-write-uri-permission]
[--grant-persistable-uri-permission] [--grant-prefix-uri-permission]
[--debug-log-resolution] [--exclude-stopped-packages]
[--include-stopped-packages]
[--activity-brought-to-front] [--activity-clear-top]
[--activity-clear-when-task-reset] [--activity-exclude-from-recents]
[--activity-launched-from-history] [--activity-multiple-task]
[--activity-no-animation] [--activity-no-history]
[--activity-no-user-action] [--activity-previous-is-top]
[--activity-reorder-to-front] [--activity-reset-task-if-needed]
[--activity-single-top] [--activity-clear-task]
[--activity-task-on-home]
[--receiver-registered-only] [--receiver-replace-pending]
[--selector]
[<URI> | <PACKAGE> | <COMPONENT>]
Error: Unknown component: com.horntell.test/com.horntell.test.MainActivity
Error while Launching activity
This problem occur mostly when I try to push the code for the first time. i.e. App is not already present in the phone.
Sometimes, I have to restart the IDE, or phone or both to resolve this issue and it gets really frustrating sometimes.
I am not sure but I faced a similar problem with Moto mobiles. In Motorola there are user profiles. So if I had more than one user profile then I got similar error in the case when the app was uninstalled from one of the profiles but not the other.
So you should try uninstalling the app from all the user profiles before installing it again.
I work on linux pc,
Ensured that AndroidManifest.xml has permission for INTERNET.
Tried command both with and without proxy, observation is same.
my real device has 4.1.1 android software,
AVD has 4.2.2 android with API level 17, Would that be problem?
I observe that, sample demo app gets launched on device, while I run 'calabash-android run AndroidDemoProject.apk...
but command throws error saying "App did not start" (RunTimeError).
Error details:
Feature: Demo feature
Scenario: I can start my app # features/my_first.feature:3
I wait for "Hello World, AndroidDemoProject" to appear
3707 KB/s (553745 bytes in 0.145s)
3045 KB/s (36301 bytes in 0.011s)
App did not start (RuntimeError)
/usr/lib/ruby/gems/1.8/gems/calabash-android-0.4.9/lib/calabash-android/operations.rb:512:in `start_test_server_in_background'
/usr/lib/ruby/gems/1.8/gems/retriable-1.3.3.1/lib/retriable/retriable.rb:31:in `perform'
/usr/lib/ruby/gems/1.8/gems/retriable-1.3.3.1/lib/retriable/retriable.rb:59:in `retriable'
/usr/lib/ruby/gems/1.8/gems/calabash-android-0.4.9/lib/calabash-android/operations.rb:511:in `start_test_server_in_background'
/usr/lib/ruby/gems/1.8/gems/calabash-android-0.4.9/lib/calabash-android/operations.rb:92:in `start_test_server_in_background'
/home/vijayvk/Downloads/AndroidDemoProject/calabash/features/support/app_life_cycle_hooks.rb:15:in `Before'
Failing Scenarios:
cucumber features/my_first.feature:3 # Scenario: I can start my app
I wait for "Hello World, AndroidDemoProject" to appear
1 scenario (1 failed)
0 steps
0m22.337s
===========================================================================
$calabash-android run ../AndroidDemoProject.apk --verbose, leads to below output
013-09-04 15:42:45 - /usr/bin/ruby1.8 -S cucumber --verbose MAIN_ACTIVITY=sh.calaba.demoproject.AndroidDemoProjectActivity APP_PATH="/home/vijayvk/Downloads/AndroidDemoProject/AndroidDemoProject.apk" TEST_APP_PATH="test_servers/d06f94e698e2dfae7d59f229087ea78f_0.4.9.apk"
Code:
* features/support/env.rb
* features/support/app_installation_hooks.rb
* features/support/app_life_cycle_hooks.rb
* features/support/hooks.rb
* features/step_definitions/calabash_steps.rb
Features:
* features/my_first.feature
Parsing feature files took 0m0.002s
Feature: Demo feature
Scenario: I can start my app # features/my_first.feature:3
I wait for "Hello World, AndroidDemoProject" to appear
2013-09-04 15:42:46 - First scenario in feature - reinstalling apps
2013-09-04 15:42:46 - "/home/vijayvk/Development/adt-bundle-linux-x86-20130219/sdk/platform-tools/adb" -s 00000D6300009613 forward tcp:34777 tcp:7102
2013-09-04 15:42:46 -
2013-09-04 15:42:46 - Uninstalling: sh.calaba.demoproject.test
2013-09-04 15:42:47 - Success
2013-09-04 15:42:47 - Uninstalling: sh.calaba.demoproject
2013-09-04 15:42:49 - Success
2013-09-04 15:42:49 - Installing: test_servers/d06f94e698e2dfae7d59f229087ea78f_0.4.9.apk
3153 KB/s (553745 bytes in 0.171s)
2013-09-04 15:42:54 - pkg: /data/local/tmp/d06f94e698e2dfae7d59f229087ea78f_0.4.9.apk
Success
2013-09-04 15:42:55 - Installing: /home/vijayvk/Downloads/AndroidDemoProject/AndroidDemoProject.apk
4513 KB/s (36306 bytes in 0.007s)
2013-09-04 15:42:56 - pkg: /data/local/tmp/AndroidDemoProject.apk
Success
2013-09-04 15:42:59 - Waking up device using:
2013-09-04 15:42:59 - "/home/vijayvk/Development/adt-bundle-linux-x86-20130219/sdk/platform-tools/adb" -s 00000D6300009613 shell am start -a android.intent.action.MAIN -n sh.calaba.demoproject.test/sh.calaba.instrumentationbackend.WakeUp
Starting: Intent { act=android.intent.action.MAIN cmp=sh.calaba.demoproject.test/sh.calaba.instrumentationbackend.WakeUp }
2013-09-04 15:43:01 - Starting test server using:
2013-09-04 15:43:01 - "/home/vijayvk/Development/adt-bundle-linux-x86-20130219/sdk/platform-tools/adb" -s 00000D6300009613 shell am instrument -e class sh.calaba.instrumentationbackend.InstrumentationBackend -e target_package sh.calaba.demoproject -e test_server_port 7102 -e main_activity sh.calaba.demoproject.AndroidDemoProjectActivity -e debug false sh.calaba.demoproject.test/sh.calaba.instrumentationbackend.CalabashInstrumentationTestRunner
App did not start (RuntimeError)
/usr/lib/ruby/gems/1.8/gems/calabash-android-0.4.9/lib/calabash-android/operations.rb:512:in `start_test_server_in_background'
/usr/lib/ruby/gems/1.8/gems/retriable-1.3.3.1/lib/retriable/retriable.rb:31:in `perform'
/usr/lib/ruby/gems/1.8/gems/retriable-1.3.3.1/lib/retriable/retriable.rb:59:in `retriable'
/usr/lib/ruby/gems/1.8/gems/calabash-android-0.4.9/lib/calabash-android/operations.rb:511:in `start_test_server_in_background'
/usr/lib/ruby/gems/1.8/gems/calabash-android-0.4.9/lib/calabash-android/operations.rb:92:in `start_test_server_in_background'
/home/vijayvk/Downloads/AndroidDemoProject/calabash/features/support/app_life_cycle_hooks.rb:15:in `Before'
Failing Scenarios:
cucumber features/my_first.feature:3 # Scenario: I can start my app
I wait for "Hello World, AndroidDemoProject" to appear
1 scenario (1 failed)
0 steps
0m26.737s
==========================================================================
$ calabash-android console AndroidDemoProject/AndroidDemoProject.apk
No test server found for this combination of app and calabash version. Recreating test server.
Done signing the test server. Moved it to test_servers/d06f94e698e2dfae7d59f229087ea78f_0.4.9.apk
irb(main):004:0> ARGV << "-v"
[
[0] "--readline",
[1] "--prompt-mode",
[2] "simple",
[3] "-v"
]
irb(main):005:0> start_test_server_in_background
2013-09-04 16:29:06 - Starting test server using:
2013-09-04 16:29:06 - "/home/vijayvk/Development/adt-bundle-linux-x86-20130219/sdk//platform-tools/adb" -s 00000D6300009613 shell am instrument -e test_server_port 7102 -e class sh.calaba.instrumentationbackend.InstrumentationBackend -e debug false -e target_package sh.calaba.demoproject -e main_activity sh.calaba.demoproject.AndroidDemoProjectActivity sh.calaba.demoproject.test/sh.calaba.instrumentationbackend.CalabashInstrumentationTestRunner
RuntimeError: App did not start
from /usr/lib/ruby/gems/1.8/gems/calabash-android-0.4.9/lib/calabash-android/operations.rb:512:in `start_test_server_in_background'
from /usr/lib/ruby/gems/1.8/gems/retriable-1.3.3.1/lib/retriable/retriable.rb:31:in `perform'
from /usr/lib/ruby/gems/1.8/gems/retriable-1.3.3.1/lib/retriable/retriable.rb:59:in `retriable'
from /usr/lib/ruby/gems/1.8/gems/calabash-android-0.4.9/lib/calabash-android/operations.rb:511:in `start_test_server_in_background'
from /usr/lib/ruby/gems/1.8/gems/calabash-android-0.4.9/lib/calabash-android/operations.rb:92:in `start_test_server_in_background'
from (irb):5
Please let me know if there is any work around for this problem...
I could resolve this when I had come across this error, by doing this:
1) Close the AVD and restart
2) If (1) doesnt fix the issue, uninstall the app, and execute reinstall_apps for your app again
3) if (2) doesnt fix the issue, delete the test servers folder and execute start_test_server_in_background again.
Adding the following solves the problem as well.
<uses-permission android:name="android.permission.INTERNET" />
Reference:
http://www.luisdelarosa.com/2013/04/18/how-to-fix-problem-when-app-wont-start-when-testing-with-calabash-android/
Also you can try this way.
Inside your ruby folder find file operations.rb. Path is like this "C:\Ruby23-x64\lib\ruby\gems\2.3.0\gems\calabash-android-0.7.3\lib\calabash-android". Open the file and find the block of code:
Retriable.retriable :tries => 100, :interval => 0.1 do
raise "App did not start" unless app_running?
Change "tries" parameter value on 300 instead of 100. It will help your app run in case of insufficiently productive device.
We've tested 6 different devices with default settings, but only 2 flagship smartphones (Samsung galaxy S6) could run app with "tries" parameter value => 100.
Now all our devices can run apps great!
I'm working with the latest version of android maven plugin. I use android:deploy and android:run to launch my app on my device. When I want to debug, I go into DDMS in eclipse and check the green bug icon for my app. Everything works fine... but I can only debug a running app, ie it has already started. If I put a breakpoint in my application constructor or onCreate, it wont stop (obviously because the application has started and the debugging didn't been activated... yet).
So my question is: how can I start my app in debug mode directly from maven like I would do for an app that I start from eclipse ?
thanks ahead
Thanks to Lukasz, I found the command in Idea that is launched to trigger the debug mode.
Basically, the application is deployed with android:deploy but instead of android:run, I launch a shell "am" command with -D. Here's the usage for anyone interested.
ovh-ybi$ adb shell
# am
usage: am [subcommand] [options]
start an Activity: am start [-D] <INTENT>
-D: enable debugging
send a broadcast Intent: am broadcast <INTENT>
start an Instrumentation: am instrument [flags] <COMPONENT>
-r: print raw results (otherwise decode REPORT_KEY_STREAMRESULT)
-e <NAME> <VALUE>: set argument <NAME> to <VALUE>
-p <FILE>: write profiling data to <FILE>
-w: wait for instrumentation to finish before returning
start profiling: am profile <PROCESS> start <FILE>
stop profiling: am profile <PROCESS> stop
<INTENT> specifications include these flags:
[-a <ACTION>] [-d <DATA_URI>] [-t <MIME_TYPE>]
[-c <CATEGORY> [-c <CATEGORY>] ...]
[-e|--es <EXTRA_KEY> <EXTRA_STRING_VALUE> ...]
[--ez <EXTRA_KEY> <EXTRA_BOOLEAN_VALUE> ...]
[-e|--ei <EXTRA_KEY> <EXTRA_INT_VALUE> ...]
[-n <COMPONENT>] [-f <FLAGS>] [<URI>]
Instead of android:deploy and android:run you could just launch your application in debug by eclipse and not by maven. You have to have your project configured properly to do this.
You can deploy and start it using this post. To debug I guess and hope you only need to change some parameters.
I am trying to get the output of a WLAN driver control interface via adb shell on a motorola droid 2. The command is called wlan_cu. To run the command,I am using:
% wlan_cu -itiwlan0 -s /data/jay/stat.sh
Connection established with supplicant .../Connection> Bssid_list,
Connect, Disassociate, Status, Full_bssid_list, wPs/
Status : DISCONNECT MAC : f8.7b.7a.7b.b7.9b SSID : <empty>
BSSID : 00.00.00.00.00.00
Channel : <empty>
Driver/, Connection/, Management/, Show/, Privacy/, scAn/, roaminG/, qOs/, poWer/, eVents/, Bt coexsistance/, Report/, dEbug/, biT/, aboUt, Quit
[1] Segmentation fault wlan_cu -itiwlan0 -s /data/jay/stat.sh
The -s option is to read wlan_cu commands from a script.
% cat /data/jay/stat.sh
c s
/
q
If I try to redirect the output i.e.
% wlan_cu -itiwlan0 -s /data/jay/stat.sh &> out.txt
out.txt is created, but empty and the output still goes to screen. Anyone have an idea? been stuck on this for quite a while.
you can try to redirect both stdout and stderr to the out.txt. Try this,
# wlan_cu -itiwlan0 -s /data/jay/stat.sh > out.txt 2>&1