after a lot of tutorials regarding jenkins and android I still got stuck in having an error free build.
I did follow these tutorials:
http://www.vogella.com/articles/Jenkins/article.html
https://wiki.jenkins-ci.org/display/JENKINS/Building+an+Android+app+and+test+project
The only difference to my setup is that I'm not checking out from a repository. I have the code imported in the job itself, so in my "jobs" directory I do have a workspace with 2 projects (normal android and androidUnitTest project).
When trying to build I got this log:
-build-setup:
[getbuildtools] Using latest Build Tools: 18.0.1
[echo] Resolving Build Target for MainActivity...
[gettarget] Project Target: Android 4.0
[gettarget] API level: 14
[echo] ----------
[echo] Creating output directories if needed...
[echo] ----------
[echo] Resolving Dependencies for MainActivity...
[dependency] Library dependencies:
[dependency] No Libraries
[dependency]
[dependency] ------------------
[dependency] API<=15: Adding annotations.jar to the classpath.
[dependency] WARNING: unable to write jarlist cache file /Users/Shared/Jenkins/Home/jobs/Jenkins4AndroidTest/workspace/XJenkins/bin/jarlist.cache
[echo] ----------
[echo] Building Libraries with 'debug'...
[subant] No sub-builds to iterate on
-code-gen:
[mergemanifest] Found Deleted Target File
[mergemanifest] Merging AndroidManifest files into one.
[mergemanifest] Manifest merger disabled. Using project manifest only.'
resulting in this error:
/Users/Shared/android-sdks/tools/ant/build.xml:644: java.io.FileNotFoundException: /Users/Shared/Jenkins/Home/jobs/Jenkins4AndroidTest/workspace/XJenkins/bin/AndroidManifest.xml (Permission denied)
at java.io.FileOutputStream.open(Native Method)
Seems to me like it ignores the relative path I used at Invoke Ant
("./XJenkins/build.xml", target: debug)
Does anyone have any hint, tip or solution for this? That'll be really great!
EDIT:
I previously had the situation where I had a different error (I used some more parameters for ant as mentioned in the tutorial.) The error was this: /Users/Shared/android-sdks/tools/ant/build.xml:392: Problem: failed to create task or type checkenv
... would that be a better approach?
It seems to me a problem of ownership of the source.
Go to : /Users/Shared/Jenkins/Home/jobs/Jenkins4AndroidTest/workspace/XJenkins/bin/
and perform and : ls -rtl
You should see something like that :
-rw-r--r-- 1 jenkins jenkins AndroidManifest.xml
If not, give the right to jenkins to it with chown command. I will personnaly do it on all directory
sudo chown -R jenkins:jenkins /Users/Shared/Jenkins
This command will give ownership of ALL CONTENT within Jenkins directory to Jenkins User.
BE CAREFUL : This is assuming that Jenkins is launched as a service with User Jenkins. If you launch jenkins as a webapp on tomcat7 for instance, Jenkins user will be tomcat7 and you shall grand tomcat7 with ownership