ssamar
ssamar

Reputation: 139

How to debug android project from git using Jenkins frontend?

I have installed Jenkins on my ubuntu 11.04 system using command "apt-get install jenkins". I am able to executes "ant debug" command from linux command line well and completed successfully But when i am trying to debug Android project from git hub using jenkins frontend by setting build target "Invoke ant" with properties "sdk.dir=/opt/android-sdk-linux-ics". It is giving following error Console Output :

########################################################################################

Started by user anonymous
Building in workspace /var/lib/jenkins/workspace/touchanimtn
Checkout:touchanimtn / /var/lib/jenkins/workspace/touchanimtn - hudson.remoting.LocalChannel@72cd429b
Using strategy: Default
Last Built Revision: Revision 3e4b580644fad8b059fb5c13925d3d86fa402187 (origin/HEAD, origin/master)
Fetching changes from 1 remote Git repository
Fetching upstream changes from https://github.com/ssamar/touchanimtn.git
Seen branch in repository origin/HEAD
Seen branch in repository origin/master
Commencing build of Revision 3e4b580644fad8b059fb5c13925d3d86fa402187 (origin/HEAD, origin/master)
Checking out Revision 3e4b580644fad8b059fb5c13925d3d86fa402187 (origin/HEAD, origin/master)
Warning : There are multiple branch changesets here
[touchanimtn] $ ant -Dsdk.dir=/opt/android-sdk-linux-ics clean debug
Buildfile: /var/lib/jenkins/workspace/touchanimtn/build.xml

BUILD FAILED
/var/lib/jenkins/workspace/touchanimtn/build.xml:83: Cannot find /opt/android-sdk-linux-ics/tools/ant/build.xml imported from /var/lib/jenkins/workspace/touchanimtn/build.xml

Total time: 0 seconds
Build step 'Invoke Ant' marked build as failure
Finished: FAILURE

###################################################################################

I also tried by putting "android-sdk-linux-ics" into home folder but gave same error.

Please, Give me the correct solution for this error.

Upvotes: 1

Views: 1435

Answers (3)

Saran
Saran

Reputation: 6392

Might help someone.

Wherever ANDROID_HOME/platforms pointing to

  1. Reach in finder
  2. bring get info
  3. add Jenkins user and
  4. give read access.

This solved my problem of build.xml not found error.

Upvotes: 1

Hans Cappelle
Hans Cappelle

Reputation: 17495

This is a good question that more people will face when installing Jenkins on a linux system where the android SDK was installed before.

The problem is either that the path to the android SDK is not correct (1) or insufficient permissions for the jenkins user to access the android SDK installation path (2).

1) Path: Double check the path on your ant build step for the failing jenkins project. Go to the ant build step and click advanced. There it should have sdk.dir=SOME/PATH listed in the properties field. For multiple values make sure you expand the field and use a new line per value. Also don't include the -D to your argument since Jenkins will do that for each line.

2) Permissions: Double check the permissions on the android-sdk folder listed there. Use ls -l to get a list of current permissions and chmod to update the permissions if needed.

Notes:

It's always a good idea to switch to the jenkins user on your system and test the failing commands from the shell yourself.

sudo su jenkins

I had this kind of error also when I enabled security on my jenkins configuration. You can disable security without loosing settings by stopping the jenkins service, renaming the config file and restarting the service.

sudo service jenkins stop
sudo mv /var/lib/config.xml /var/lib/config.xml.backup
sudo service jenkins start

I didn't check in depth what user should get permissions in that case but I know reverting this change fixed the issue. Also I could still execute the ant scripts with the jenkins user as listed before.

This questions is very similar: Building android project from jenkins under linux - build fails, cannot find imported build.xml

Upvotes: 1

Christopher Orr
Christopher Orr

Reputation: 111623

Either the root of your Android SDK isn't at /opt/android-sdk-linux-ics (i.e. the tools directory should be in there, with no intermediate directories), or the SDK does exist there, but the jenkins user doesn't have permission to access it.

Upvotes: 1

Related Questions