My favorites | Sign in
Project Home Wiki Issues Source
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 4: start/stop emulator (headless) from plugin
22 people starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  ----
Closed:  Sep 2011


Sign in to add a comment
 
Reported by hugo.josefson.old@gmail.com, Jun 7, 2009
It would be nice to be able to start and stop an emulator from the
maven-android-plugin. Then it could be automatically started/stopped
before/after the platform tests.

What version of maven-android-plugin are you using?
2.0.0-SNAPSHOT as of 2009-06-07.

What is the output of "mvn -version" on your machine?
Maven version: 2.0.10
Java version: 1.6.0_13
OS name: "linux" version: "2.6.28-11-generic" arch: "i386" Family: "unix"

Jun 7, 2009
#1 hugo.josefson.old@gmail.com
Implementation note:
find a good way of launching a background process, and then taking it down in another
goal/phase. see if cargo plugin runs a detached process like this, with for example
tomcat.
Jun 7, 2009
#2 hugo.josefson.old@gmail.com
(No comment was entered for this change.)
Labels: Component-Standalone
Jun 14, 2009
#3 hugo.josefson.old@gmail.com
Implementation note:
Look at how Charlie Collins did it in android-maven (also Apache License 2.0):

https://code.google.com/p/android-maven/source/browse/#svn/android-maven-
plugin/trunk/src/main/java/com/totsp/mavenplugin/android

Dec 7, 2009
Project Member #4 jameslee...@gmail.com
Is there a chance of getting this moved from Low to a higher priority? This is the
only thing now preventing running continuous builds of our portable and Android code.
Dec 17, 2009
#5 hugo.josefson.old@gmail.com
Done. Thanks for bringing it up.

I have started by sending a request to Charlie Collins to learn what's happened to
his project. (the link in my Comment 3 above is dead)

/Hugo
Labels: -Priority-Low Priority-High Milestone-2.3.0
Dec 17, 2009
#6 charlie....@gmail.com
I undeleted the project so you can take a look there. I had deleted it on Google Code 
so as not to confuse people and get in the way of this project. 

Basically I just have a ProcessWatcher and script mojos that run it from the command 
line. Not the most elegant way but simple, but back then it worked. Might be a more 
programmatic way, not sure. 

Also, you might want to look at the more robust Maven way to launch and external 
process, if that is what is needed (see JavaCommand in here, which uses plexus 
Commandline stuff):

http://mojo.codehaus.org/gwt-maven-
plugin/xref/org/codehaus/mojo/gwt/shell/AbstractGwtShellMojo.html
Dec 17, 2009
#7 hugo.josefson.old@gmail.com
Hi Charlie,

That was quick :)

Thanks!

You can close android-maven again if you like, because I have now copied its
subversion repo to an archive at github:
http://github.com/hugojosefson/OLD-ARCHIVED-android-maven

(I hope that's alright. Let me know otherwise.)

It was interesting to see the example from gwt-maven-plugin too. I like to work like
that myself; remembering some plugin I've seen which does something similar to what I
want, and then doing like they do.

In case you are in the mood, and have the time to spare, you are quite welcome to
take a stab at implementing something around this... Even if it would just be a
standalone main class running the emulator in a controlled way :)

Again, thanks.
/Hugo
Dec 17, 2009
#8 hugo.josefson.old@gmail.com
Implementation note: I recall that the emulator listens to one more port when it
starts, which you can connect with a TCP socket to. You can give it simple text
commands through there, and that is probably the nicest way to tell it to shut down,
rather than just killing off the process.
Dec 17, 2009
#9 charlie....@gmail.com
Also, just noticed this evening that you already have a nice "CommandExecutor" - could 
use that. 

http://github.com/jayway/maven-android-
plugin/blob/master/src/main/java/com/jayway/maven/plugins/android/CommandExecutor.java
Feb 10, 2010
Project Member #10 mosa...@gmail.com
I have emulator starting implemented in my github branch. I will clean things up with 
Hugo and implement stopping hopefully and then we will get it into the next release 
hopefully.
Feb 15, 2010
Project Member #11 mosa...@gmail.com
implemented stopping and starting now in my github branch. Only for nix for now. Need 
some help with windows scripting. Hopefully all is good and hugo can pull this up. 
Feb 24, 2010
#12 hugo.josefson.old@gmail.com
Great! I pulled that in and released Maven Android Plugin 2.3.0. Let's keep this issue 
open for while longer, until "mvn android:emulator-stop" is supported in Windows too.

Status: Started
Labels: -OpSys-All -Milestone-2.3.0 OpSys-Windows
Feb 24, 2010
#13 hugo.josefson.old@gmail.com
(No comment was entered for this change.)
Owner: mosabua
Mar 12, 2010
Project Member #14 mosa...@gmail.com
I have added another patch for the plugin to work on macos under certain 
configurations with launchd. I think we should maybe just release the new version as 
2.3.1 and get people to test the windows support from it. We could maybe announce on 
the maven users and dev lists (I can do that), but we have to get the barrier for testing 
low, which is why I vote for just releasing it. Worst case it doesnt work, which is just like 
now, but with some luck it works.. 

Mar 13, 2010
#15 hugo.josefson.old@gmail.com
INSTRUCTIONS FOR ANYONE TO TEST ON WINDOWS:

1. Set environment variable ANDROID_HOME to where you installed the Android SDK.
2. Run the Android AVD manager (by clicking the cell phone button in Eclipse, or by running 
the command 'android' in the Android SDK tools directory.)
3. Create an AVD named 'Default'.
4. Run these commands:

mvn com.jayway.maven.plugins.android.generation2:maven-android-plugin:emulator-start
mvn com.jayway.maven.plugins.android.generation2:maven-android-plugin:emulator-stop

The first command should start the emulator.
The second command should kill it.

Please let us know if the first and/or second command(s) work or fail.

Thanks!
Mar 21, 2010
Project Member #16 jameslee...@gmail.com
The emulator-start goal fails on Windows.

The command window has:

[INFO] ------------------------------------------------------------------------
[INFO] Building All jimandlisa.com Projects
[INFO]    task-segment:
[com.jayway.maven.plugins.android.generation2:maven-android-plugin:emulator-
start] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] [android:emulator-start {execution: default-cli}]
[INFO] Android emulator command: C:\devjim\tools\android/tools/emulator -avd Default
unknown
[INFO] Starting android emulator with script:
C:\DOCUME~1\Jim\LOCALS~1\Temp\\maven-android-plugin-em
ulator-start.bat

C:\devjim\projects\trunk\All>START MavenAndroidPlugin-AVDDefault
C:\devjim\tools\android/tools/emula
tor -avd Default

This results in a Windows modal dialog with the title
"MavenAndroidPlugin-AVDDefault", and the message "Windows cannot find
'MavenAndroidPlugin-AVDDefault'. Make sure you typed the name correctly, and then try
again. To search for a file, click the Start button, and then click Search."

Clicking OK on the dialog causes this to display in the command window:

C:\devjim\projects\trunk\All>START MavenAndroidPlugin-AVDDefault
C:\devjim\tools\android/tools/emula
tor -avd Default
[ERROR] The system cannot find the file MavenAndroidPlugin-AVDDefault.

C:\devjim\projects\trunk\All>FOR /F "tokens=2" %I in ('TASKLIST /NH /FI "WINDOWTITLE
eq MavenAndroid
Plugin-AVDDefault"') DO SET PID=%I
[ERROR] INFO: No tasks running with the specified criteria.

C:\devjim\projects\trunk\All>ECHO  
1>C:\DOCUME~1\Jim\LOCALS~1\Temp\/maven-android-plugin-emulator.p
id
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO]

Embedded error: ANDROID-040-001: Could not execute: Command = cmd.exe /X /C
"C:\DOCUME~1\Jim\LOCALS~
1\Temp\\maven-android-plugin-emulator-start.bat", Result = 0
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7 minutes 28 seconds
[INFO] Finished at: Sun Mar 21 13:15:38 PDT 2010
[INFO] Final Memory: 29M/254M
[INFO] ------------------------------------------------------------------------
C:\devjim\projects\trunk\All>

The emulator-stop goal fails with:

[INFO]    task-segment:
[com.jayway.maven.plugins.android.generation2:maven-android-plugin:emulator-
stop] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] [android:emulator-stop {execution: default-cli}]
[INFO] Stopping android emulator with pid: ECHO is on.
[ERROR] ERROR: Invalid Syntax. Specify valid numeric value for '/PID' option.
[ERROR] Type "TASKKILL /?" for usage.
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO]

Embedded error: ANDROID-040-001: Could not execute: Command = cmd.exe /X /C "TASKKILL
/PID "ECHO is
on."", Result = 1
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9 seconds
[INFO] Finished at: Sun Mar 21 13:18:51 PDT 2010
[INFO] Final Memory: 25M/254M
[INFO] ------------------------------------------------------------------------
C:\devjim\projects\trunk\All>

Mar 23, 2010
Project Member #17 mosa...@gmail.com
First - could you post the contents of the file 
C:\DOCUME~1\Jim\LOCALS~1\Temp\\maven-android-plugin-emulator-start.bat

Second - could you try starting the emualtor with the command 
C:\devjim\tools\android/tools/emulator -avd Default

Third try the command 
START MavenAndroidPlugin-AVDDefault C:\devjim\tools\android/tools/emulator -
avd Default

If the first two work the third is probably the problem. If that is the case make a bat 
file with the command from second called test.bat and try
START MavenAndroidPlugin-AVDDefault test.bat

Stopping most likely only fails because starting did not work since it relies on a .pid 
file that never got created.. 
Apr 15, 2010
#18 mikenere...@gmail.com
I also fail at START MavenAndroidPlugin-AVDDefault 

This results in a Windows modal dialog with the title
"MavenAndroidPlugin-AVDDefault", and the message "Windows cannot find
'MavenAndroidPlugin-AVDDefault'. Make sure you typed the name correctly, and then try
again. To search for a file, click the Start button, and then click Search."

Where does MavenAndroidPlugin-AVDDefault come from?
Apr 16, 2010
Project Member #19 mosa...@gmail.com
If you do not specifi the avd in the emulator config in the pom file you the plugin will try to start an emualtor 
named "Default". You have to mamuallry created that with the avd manager. On windows it might still not work. I 
have no access to a windows machine and can not debug it.  Somebody needs to follow the steps I documented 
above and send me the results or debug themselves.. 
May 23, 2010
Project Member #20 jameslee...@gmail.com
The .bat has:

START MavenAndroidPlugin-AVDDefault C:\devjim\tools\android/tools/emulator -avd Default 
FOR /F "tokens=2" %%I in ('TASKLIST /NH /FI "WINDOWTITLE eq
MavenAndroidPlugin-AVDDefault"' ) DO SET PID=%%I
ECHO %PID% > C:\DOCUME~1\Jim\LOCALS~1\Temp\/maven-android-plugin-emulator.pid

The .pid file exists.


May 23, 2010
Project Member #21 jameslee...@gmail.com
Running the START command by hand brings up the same modal error dialog.
May 24, 2010
Project Member #22 mosa...@gmail.com
Can you try to change and see if the second part of the first line: 

C:\devjim\tools\android/tools/emulator -avd Default 

works. If so, please check if adding start at the front works as well .. 

START C:\devjim\tools\android/tools/emulator -avd Default 

and also try adding double quotes around the windowtitle like so
START "MavenAndroidPlugin-AVDDefault" C:\devjim\tools\android/tools/emulator -avd Default 

If that works with the quotes edit the whole script by adding the quotes and then run it.  Once thats is 
fine.. confirm that the number (process id) in the file is the same as the one of the emultor (using some 
sort of taskmanager or so).

If the pid is fine. Try running the emulator stop command and see if that works: 

mvn android:emulator-stop

If anything goes wrong along the lines... put the output in a comment here.  Thanks a lot ...






May 25, 2010
Project Member #23 jameslee...@gmail.com
Adding double quotes around "MavenAndroidPlugin-AVDDefault" in the generated .bat
works fine. The emulator launches correctly.

Shut down does not work, despite the PID being correct. The error is:

C:\Documents and Settings\Jim\Local Settings\Temp>mvn android:emulator-stop
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'android'.
[INFO] com.jayway.maven.plugins.android.generation2: checking for updates from
oss.sonatype.org-jayw
ay-releases
[INFO] com.jayway.maven.plugins.android.generation2: checking for updates from
snapshot.codehaus.org

[INFO] org.apache.maven.plugins: checking for updates from
oss.sonatype.org-jayway-releases
[INFO] org.apache.maven.plugins: checking for updates from snapshot.codehaus.org
[INFO] org.codehaus.mojo: checking for updates from oss.sonatype.org-jayway-releases
[INFO] org.codehaus.mojo: checking for updates from snapshot.codehaus.org
[INFO] artifact com.jayway.maven.plugins.android.generation2:maven-android-plugin:
checking for upda
tes from oss.sonatype.org-jayway-releases
[INFO] artifact com.jayway.maven.plugins.android.generation2:maven-android-plugin:
checking for upda
tes from snapshot.codehaus.org
Downloading:
http://oss.sonatype.org/content/repositories/jayway-releases/com/jayway/maven/plugins/a
ndroid/generation2/maven-android-plugin/2.4.0/maven-android-plugin-2.4.0.pom

Downloading:
http://oss.sonatype.org/content/repositories/jayway-releases/com/jayway/maven/plugins/a
ndroid/generation2/maven-android-plugin/2.4.0/maven-android-plugin-2.4.0.jar
68K downloaded  (maven-android-plugin-2.4.0.jar)
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Default Project
[INFO]    task-segment: [android:emulator-stop] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] [android:emulator-stop {execution: default-cli}]
[INFO] Stopping android emulator with pid: 948
[ERROR] ERROR: Invalid Syntax. Specify valid numeric value for '/PID' option.
[ERROR] Type "TASKKILL /?" for usage.
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO]

Embedded error: ANDROID-040-001: Could not execute: Command = cmd.exe /X /C "TASKKILL
/PID "948 "",
Result = 1
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 24 seconds
[INFO] Finished at: Tue May 25 19:22:18 PDT 2010
[INFO] Final Memory: 25M/254M
[INFO] ------------------------------------------------------------------------
C:\Documents and Settings\Jim\Local Settings\Temp>
May 25, 2010
Project Member #24 jameslee...@gmail.com
Shutdown will work once the Maven plugin generates a slightly different TASKKILL command:

C:\Documents and Settings\Jim\Local Settings\Temp>cmd.exe /X /C "TASKKILL /PID 948"
SUCCESS: The process with PID 948 has been terminated.
May 25, 2010
Project Member #25 mosa...@gmail.com
Okay.. I have committed fixes to my github branch. Ideally you could download and build it and test it out. 
Download from
http://github.com/mosabua/maven-android-plugin

Then build with 
mvn clean install

and up the version of the plugin in your test project to 2.4.1-SNAPSHOT and you should be ready to go. 
Fingers crossed and let me know how it goes.


May 31, 2010
Project Member #26 jameslee...@gmail.com
Skipping tests, it builds. Running mvn
com.jayway.maven.plugins.android.generation2:maven-android-plugin:emulator-start, it
starts the emulator, but the build window hangs at:

[INFO] [android:emulator-start {execution: default-cli}]
[INFO] Android emulator command: C:\devjim\tools\android/tools/emulator -avd Default
unknown
[INFO] Starting android emulator with script:
C:\DOCUME~1\Jim\LOCALS~1\Temp\\maven-android-plugin-em
ulator-start.bat

C:\zzz>START "MavenAndroidPlugin-AVDDefault"  C:\devjim\tools\android/tools/emu
lator -avd Default

C:\zzz>FOR /F "tokens=2" %I in ('TASKLIST /NH /FI "WINDOWTITLE eq MavenAndroidP
lugin-AVDDefault"') DO SET PID=%I

C:\zzz>SET PID=428

C:\zzz>ECHO 428  1>C:\DOCUME~1\Jim\LOCALS~1\Temp\/maven-android-plugin-emulator
.pid

Is it supposed to block, or keep going? If block, then it's working.

In a separate window, running mvn
com.jayway.maven.plugins.android.generation2:maven-android-plugin:emulator-stop did
not work:

[INFO] Stopping android emulator with pid: 428
[ERROR] ERROR: Invalid Argument/Option - '/PID 428 '.
[ERROR] Type "TASKKILL /?" for usage.
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO]

Embedded error: ANDROID-040-001: Could not execute: Command = cmd.exe /X /C "TASKKILL
"/PID 428 "",
 Result = 1
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8 seconds
[INFO] Finished at: Sat May 29 12:46:46 PDT 2010
[INFO] Final Memory: 28M/254M
[INFO] ------------------------------------------------------------------------

When the emulator was stopped manually, the blocked output resumed and displayed:

[INFO] Waiting for emulator start:5000
May 31, 2010
Project Member #27 mosa...@gmail.com
Thanks... I will have to take a look at this some more later. It is supposed to keep going .. and the emulator 
stop is supposed to leave out the apostrophes... darn. 
Jun 16, 2010
Project Member #28 jameslee...@gmail.com
You need to specify the /separate arg after the start command:

START /separate "MavenAndroidPlugin-AVDDefault" C:\devjim\tools\android/tools/emulator -avd Default
Jun 17, 2010
Project Member #29 mosa...@gmail.com
I have added that to the command line now. Can you retry? 
Aug 26, 2010
#30 mserv...@gmail.com
What's the status at the moment? With maven-android-plugin 2.5.2 android:emulator-start is still blocking.
Aug 26, 2010
Project Member #31 mosa...@gmail.com
What is the command line in the script ? Looking at the code the command line produced should be as above, but I have no way of verifying. No windows machine or vm available...  if somebody could step up and debug this with windows so a valid start script is created that would be great. Neither Hugo nor myself have any Windows around.. 

Can you check if the script on its own works? 

Aug 26, 2010
Project Member #32 cspeche...@gmail.com
patch attached
fixes - emulator cannot be stopped on windows because of command params not set
correctly in the stop command, also makes sure to start the emulator when the device is
connected to the usb, by passing the -e option to adb when getting the serial number.
patch4Issue4
1.3 KB   View   Download
Aug 26, 2010
Project Member #33 cspeche...@gmail.com
This works on windows 7, not sure of other flavors.
The following issue is still present, after starting the emulator, you have to Ctrl+C to quit the batch file.
Aug 27, 2010
Project Member #34 mosa...@gmail.com
So would it be possible to launch the script into the background somehow or make it exist by adding something to the script? 

Aug 27, 2010
Project Member #35 mosa...@gmail.com
Also in your patch you are separating the pid into separate parameters. This caused issues with apostrophes in the past.. weird. But since it is working for you... I will apply this patch tonight.. maybe you can find a solution for the backgrounding/exiting. Does adding & not work? 
Aug 27, 2010
Project Member #36 mosa...@gmail.com
I pushed the patch into my github clone and made a pull request.
Sep 26, 2010
#37 hugo.josefson.old@gmail.com
I released maven-android-plugin 2.6.0 with that patch in it. Is this issue resolved?
Oct 3, 2010
Project Member #38 mosa...@gmail.com
Good question... some windows users need to confirm...
Nov 6, 2010
#39 bdhr...@msn.com
When I call mvn android:emulator-start on windows 7 64bit the emulator starts but hangs the command line. The output is as follows.

C:\dev\workspaces\eclipse-SDK-3.5.2-win32\Foo>mvn android:emulator
-start
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Market Risk Android
[INFO]    task-segment: [android:emulator-start] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] [android:emulator-start {execution: default-cli}]
[INFO] Android emulator command: C:\dev\tools\android-sdk-windows/tools/emulator
 -avd FooAvd
unknown
[INFO] Starting android emulator with script: C:\Users\dhruba\AppData\Local\Temp
\\maven-android-plugin-emulator-start.bat

C:\dev\workspaces\eclipse-SDK-3.5.2-win32\Foo>START /separate "Mav
enAndroidPlugin-AVDFooAvd"  C:\dev\tools\android-sdk-windows/tools
/emulator -avd FooAvd

C:\dev\workspaces\eclipse-SDK-3.5.2-win32\Foo>FOR /F "tokens=2" %I
 in ('TASKLIST /NH /FI "WINDOWTITLE eq MavenAndroidPlugin-AVDFooAv
d"') DO SET PID=%I

C:\dev\workspaces\eclipse-SDK-3.5.2-win32\Foo>SET PID=5180

C:\dev\workspaces\eclipse-SDK-3.5.2-win32\Foo>ECHO 5180  1>C:\User
s\dhruba\AppData\Local\Temp\/maven-android-plugin-emulator.pid

At this point it hangs until the emulator has been manually closed. Once closed it releases maven and it carries on as follows.

[INFO] Waiting for emulator start:6000
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 minute 41 seconds
[INFO] Finished at: Sat Nov 06 18:26:29 GMT 2010
[INFO] Final Memory: 18M/45M
[INFO] ------------------------------------------------------------------------

The output of the script (C:\Users\foo\AppData\Local\Temp\\maven-android-plugin-emulator-start.bat) is as follows.

START /separate "MavenAndroidPlugin-AVDMarketRiskAndroidAvd"  C:\dev\tools\android-sdk-windows/tools/emulator -avd MarketRiskAndroidAvd 
FOR /F "tokens=2" %%I in ('TASKLIST /NH /FI "WINDOWTITLE eq MavenAndroidPlugin-AVDMarketRiskAndroidAvd"' ) DO SET PID=%%I
ECHO %PID% > C:\Users\dhruba\AppData\Local\Temp\/maven-android-plugin-emulator.pid

The script clearly has "START /separate" but that doesn't work. Is there any way to start this in the background?

Many thanks.
Nov 6, 2010
Project Member #40 mosa...@gmail.com
So if I understand correctly it gets the right PID and the emulator is starting up but the command ECHO %PID% > ... does not hang up. Can you check out if the pid file has the right number in it (5180) And can you check if the script runs on its own and exits?
Nov 7, 2010
#41 bdhr...@msn.com
Thanks for getting back to me. Yes the pid file has the right number in it each time (although there is a new line after the PID). Also the script runs on its own and does exit. I noticed one other thing though. When I run mvn android:emulator-start and all the dos windows pop up one of them has an error that comes up and goes away very quickly. I've managed to screenshot it after several failed attempts. It is attached. I'm not sure if it will have any relation to this problem. In conclusion the dos prompt still hangs and the wait time is only applied after the emulator is closed.
Nov 7, 2010
#42 bdhr...@msn.com
Sorry I had to delete the previous attachment. I've uploaded a new one.
maven-android-error2.png
57.9 KB   View   Download
Nov 8, 2010
Project Member #43 mosa...@gmail.com
Whoa.. I have no idea what that one is nor how it could happen.
Dec 30, 2010
#44 thiagoca...@gmail.com
well, the emulator-stop is not yet working as you can see on the error log below.
seems like there is two extra quotes around the PID.
btw, I am using windows xp and the version 2.8.3



[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building HelloFlashlight 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-android-plugin:2.8.3:emulator-stop (default-cli) @ helloflashlight ---
[INFO] Stopping android emulator with pid: 6248 
[INFO] ERROR: Invalid Syntax. Specify valid numeric value for '/PID' option.
[INFO] Type "TASKKILL /?" for usage.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.469s
[INFO] Finished at: Thu Dec 30 08:23:58 BRST 2010
[INFO] Final Memory: 4M/8M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.jayway.maven.plugins.android.generation2:maven-android-plugin:2.8.3:emulator-stop (default-cli) on project helloflashlight: MojoExecutionException: ANDROID-040-001: Could not execute: Command = cmd.exe /X /C "TASKKILL /PID "6248 "", Result = 1 -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Dec 30, 2010
Project Member #45 mosa...@gmail.com
Could you try patching and fixing it under windows yourself? I have no way of testing it since I have no windows around here..  all you would have to do is change the method stopEmulatorWindows in the AbstractEmulatorMojo. I am a bit confused though since it seems to be working on windows 7 for some users... 

Jan 28, 2011
#46 duo.ska...@gmail.com
hi, 
i am also having this problem on win7 64-bit. is the issue resolved? if not, is there any workaround??
Jan 28, 2011
Project Member #47 mosa...@gmail.com
The windows users will have to find a windows developer that can help them out. I cant as stated many times before.
Feb 18, 2011
#48 kkba...@gmail.com
I want to fix this issue. But can anyone help me get the source code.
I am getting the following error when i try to download the source from command line
==================================================================
$ git clone git://github.com/jayway/maven-android-plugin.git
Cloning into maven-android-plugin...
github.com[0: 207.97.227.239]: errno=Invalid argument
fatal: unable to connect a socket (Invalid argument)
================================================================
Its not even working form elcipse GIT plugin.

Feb 18, 2011
Project Member #49 mosa...@gmail.com
Looks like a local network issue. Do other git repos work? The command is correct and works for me.. also check your git version maybe.
Labels: -Component-Device
Jun 5, 2011
#50 Robt.W....@gmail.com
WIN XP x64 I found emulator-start worked;  emulator-stop failed.  See below
E:\Android_Samples\jayway-maven-android-plugin-samples-08bd019\helloflashlight>mvn com.jayway.maven.plugins.android.generation2:maven-androi
d-plugin:emulator-stop
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building HelloFlashlight
[INFO]    task-segment: [com.jayway.maven.plugins.android.generation2:maven-android-plugin:emulator-stop] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] [android:emulator-stop {execution: default-cli}]
[INFO] Stopping android emulator with pid: No
[INFO] ERROR: The process "No " not found.
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO]

Embedded error: ANDROID-040-001: Could not execute: Command = cmd.exe /X /C "TASKKILL /PID "No "", Result = 128
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10 seconds
[INFO] Finished at: Sun Jun 05 20:27:56 EDT 2011
[INFO] Final Memory: 23M/194M
[INFO] ------------------------------------------------------------------------
E:\Android_Samples\jayway-maven-android-plugin-samples-08bd019\helloflashlight>
Jun 22, 2011
#51 lenciel
I have the same issue here:

win7 x32 emulator-start works fine but emulator-stop failed:

[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO]

Embedded error: ANDROID-040-001: Could not execute: Command = cmd.exe /X /C "TASKKILL /PID "No "", Result = 128
Aug 17, 2011
#52 lmichen...@gmail.com
Is it possible that the plugin uses the following command to know if the emulator is ready instead of using the wait parameter ?

/opt/sdk-android/platform-tools/adb -s emulator-5554 shell getprop dev.bootcomplete


Aug 17, 2011
#53 lmichen...@gmail.com
Maybe better command :

/opt/sdk-android/platform-tools/adb wait-for-device shell getprop
Aug 17, 2011
Project Member #54 mosa...@gmail.com
Yes.. even better would be to use ddmlib... feel free to implement and send a pull request. 
Owner: ---
Sep 7, 2011
Project Member #55 mosa...@gmail.com
This is now using ddmlib/adbbridge in master instead of pid files and should be available with 3.0.0-alpha-7. Please test this on Windows as soon as it is available. 

In terms of the wait for device change. Please file a separate issue. 
Status: Fixed
Sign in to add a comment

Powered by Google Project Hosting