Cannot open Android Emulator using openApp "emulator64-arm"

Asked by Jeremiah Jacquet

Hi I am trying to bring the Android Emulator to the front of the screen once I have manually launched it using the command lines in the "/android-sdk-mac_86/tools".

I am doing this in Java

Here is the method I am using once its launched, but it doesn't work:

 public static void setAndroidSim() throws Exception {
  SikuliScript app = new SikuliScript();

  app.openApp("emulator64-arm");
 }

Please note this works for all the other running apps

Is it running under another name that I can't see?
The header of the emulator shows the port and device as named in the device manager (i.e. 5554:NAME_OF_DEVICE_FROM_AVD)

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

--1. when programming in Java, you should not step up to the Jython level (do not use classes SikuliScript...), unless you want to run Jython scripts from inside Java.

--2. use
App.focus("app-name");

Internally the process name is used to identify the app (be aware: on Mac currently it is not possible to bring to front a specific window of an app).

Looking into the activity monitor might help (open files) or ps on command line, to find out what "app-name" should be.

Revision history for this message
Jeremiah Jacquet (jeremiahjacquet) said :
#2

On my Mac I looked in Activity Monitor, ran 'top' in the Terminal and used the name of the Android Emulator emulator64-x86. Sikuli does not find it.

 - I launch the android emulator using command line in the terminal:
/adt-bundle-mac-x86/sdk/tools/emulator -avd TestAndroidNexus

My Java code is as follow:

  App myApp = new App("emulator64-x86");
  App.open("emulator64-x86");

The console output in Eclipse says:

[log] App.open emulator64-x86(0)
[error] App.open failed: emulator64-x86 not found

Maybe its as you said "(be aware: on Mac currently it is not possible to bring to front a specific window of an app)."

Revision history for this message
RaiMan (raimund-hocke) said :
#3

so simply
App emu = App.open("/adt-bundle-mac-x86/sdk/tools/emulator"); // static method

should work.
if not, emu is null

Can you help with this problem?

Provide an answer of your own, or ask Jeremiah Jacquet for more information if necessary.

To post a message you must log in.