How to build android-robot jar file on Mac OSX Lion

Asked by Don Phan

***** This is a basic related question on android-robot
https://answers.launchpad.net/sikuli/+question/169859

New information will be updated there

-----------------------------------------------------------------------------

Hello,

Looks like the link to download android-robot jar file : http//sikuli.org/dl/android-robot-0.2.jar is not available anymore.
Can you show me the steps of how to build android-robot jar file on Mac OSX Lion.

Thank you,
--Don

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
Revision history for this message
Don Phan (dungdangphan) said :
#2

Thanks Rai for the fast response.
I went to that link and download the sources, however, I have a dumb question:
- What do I need to do next in order to build it.

Thanks again,
--Don

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

The error log, you posted with the other question, shows, that you need the sikuli script classes.

You should download the whole repository and the build the adroid jar.

Revision history for this message
Don Phan (dungdangphan) said :
#4

Yes - I did download the whole source tree ( from the tar.gz). Here are my steps:
1. Download the sikuli-sikuli-699d404.tar
2. Install Xcode, Cmake, OpenCV, Tesseract, SWIG.
3. Open Terminal - Go to android-robot folder
4. Make a subfolder "build" in "android-robot/" and try to build it
5. $ cmake .. ( makefile is created in android-robot )
6. $ cd .. ( to go back to android-robot folder )
7. $ make

=> This is when I got the error.
Thanks,
--Don

Revision history for this message
Don Phan (dungdangphan) said :
#5

BTY, how do include the sikuli script classes? I did install the Mac version of Sikuli X 1.0rc3 to my Mac and I can open it just fine.
Thanks,

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

@ Don
I had a look at the android stuff (latest OS X Lion).

It seems, that the currently available version of monkeyrunner, that comes with the Android SDK, is no longer compatible with the android-robot-0.3 sources:
- adb class no longer available in monkeyrunner (has been moved elsewhere ?)
- there is a strange error with the class MonkeyDevice, so I guess something changed there too

So i had no chance to get the make work and produce a jar file.

I guess this is the reason, why the jar cannot be downloaded anymore: it does not work with the current Android SDK anyway.

So one has to fix the problems in the android-robot source to get this feature working again. Since I do not have any experience with Android and I am not the developer, I cannot help you here.

*** BTW: this is the way to run the build

(as you will see: all actions happen in the build folder! This is the recommended way and allows to forget unsuccessful builds by simply deleting this folder.)

1. Download the current Sikuli sources from GitHub (however you do that)
2. If you do not build sikuli-script.jar from the sources, copy an actual sikuli-script.jar (Mac: from /Applications/Sikuli-IDE.app/Contents/Resources/Java) to the folder lib (is on same level as extensions)
2. Make sure you have Xcode and Cmake (OpenCV, Tesseract, SWIG only needed for building sikuli-script.jar)
3. make sure you have a valid Android SDK (> version 10) on your system (this build expects it to be in /opt/android-sdk-mac_x86 - if this is not the case, you have to change the CmakeLists.txt in 2 places)
3. Open Terminal - Go to android-robot folder in the extension folder of the Sikuli stuff
4. Make a subfolder "build" in "android-robot/"
5. cd to this empty build folder
5. $ cmake .. ( makefile is created in build/)
7. $ make

Revision history for this message
Don Phan (dungdangphan) said :
#7

Thanks RaiMan.
This time I got the following error:

DonPs-MacBook-Pro:build donphan$ make
Scanning dependencies of target android-robot-0.3.jar.py-in-jar
[ 0%] Built target android-robot-0.3.jar.py-in-jar
Scanning dependencies of target android-robot.classes
/Users/donphan/Work/sikuli-source/extensions/android-robot/src/main/java/org/sikuli/script/android/AndroidScreen.java:25: package com.android.monkeyrunner.adb does not exist
import com.android.monkeyrunner.adb.AdbBackend;
                                   ^
/Users/donphan/Work/sikuli-source/extensions/android-robot/src/main/java/org/sikuli/script/android/AndroidRobot.java:156: type(org.python.core.PyObject[],java.lang.String[]) in com.android.monkeyrunner.MonkeyDevice cannot be applied to (java.lang.String)
         _dev.type(""+character);
             ^
/Users/donphan/Work/sikuli-source/extensions/android-robot/src/main/java/org/sikuli/script/android/AndroidRobot.java:189: cannot find symbol
symbol : variable TouchPressType
location: class com.android.monkeyrunner.MonkeyDevice
      _dev.touch(_mouse.x, _mouse.y, MonkeyDevice.TouchPressType.DOWN);
                                                 ^
and many more...

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

This is what I already mentioned in comment #6 at the beginning:

It seems, that the currently available version of monkeyrunner, that comes with the Android SDK, is no longer compatible with the android-robot-0.3 sources

and I said (Sorry):

So one has to fix the problems in the android-robot source to get this feature working again. Since I do not have any experience with Android and I am not the developer, I cannot help you here.

I will not dive deeper into this stuff, since I am not interested in Android.

Revision history for this message
Don Phan (dungdangphan) said :
#9

OK - Thanks RaiMan
--Don

On Thu, Apr 26, 2012 at 1:30 AM, RaiMan <
<email address hidden>> wrote:

> Your question #194069 on Sikuli changed:
> https://answers.launchpad.net/sikuli/+question/194069
>
> Status: Open => Answered
>
> RaiMan proposed the following answer:
> This is what I already mentioned in comment #6 at the beginning:
>
> It seems, that the currently available version of monkeyrunner, that
> comes with the Android SDK, is no longer compatible with the android-
> robot-0.3 sources
>
> and I said (Sorry):
>
> So one has to fix the problems in the android-robot source to get this
> feature working again. Since I do not have any experience with Android
> and I am not the developer, I cannot help you here.
>
> I will not dive deeper into this stuff, since I am not interested in
> Android.
>
> --
> If this answers your question, please go to the following page to let us
> know that it is solved:
> https://answers.launchpad.net/sikuli/+question/194069/+confirm?answer_id=7
>
> If you still need help, you can reply to this email or go to the
> following page to enter your feedback:
> https://answers.launchpad.net/sikuli/+question/194069
>
> You received this question notification because you asked the question.
>

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

Just to keep it visible

Can you help with this problem?

Provide an answer of your own, or ask Don Phan for more information if necessary.

To post a message you must log in.