Reputation: 111
Trying to build an android-project with ant in Jenkins, but I get an exception.
I can reproduce this error with "sudo -u jenkins ant debug" in console.
/opt/android-sdk-mac_x86/tools/ant/build.xml:539: Unable to resolve project target 'android-17'
at com.android.ant.GetTargetTask.execute(GetTargetTask.java:160)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:390)
at org.apache.tools.ant.Target.performTasks(Target.java:411)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.Main.runBuild(Main.java:809)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
One is obviously led to believe that the cause of this is that it can't find the sdk for 'android-17', but when I run the same command with my regular user (yes I run jenkins on my dev machine right now to make sure it works) it compiles fine.
Full log of the Jenkins build:
Buildfile: /Users/Shared/Jenkins/Home/jobs/test1/workspace/build.xml
-check-env:
[checkenv] Android SDK Tools Revision 21
[checkenv] Installed at /opt/android-sdk-mac_x86
-setup:
[echo] Project Name: <ProjectName>
[gettype] Project Type: Application
-pre-clean:
clean:
[delete] Deleting directory /Users/Shared/Jenkins/Home/jobs/test1/workspace/bin
[delete] Deleting directory /Users/Shared/Jenkins/Home/jobs/test1/workspace/gen
[getlibpath] Library dependencies:
[getlibpath] No Libraries
[subant] No sub-builds to iterate on
-set-mode-check:
-set-debug-files:
-check-env:
[checkenv] Android SDK Tools Revision 21
[checkenv] Installed at /opt/android-sdk-mac_x86
-setup:
[echo] Project Name: <ProjectName>
[gettype] Project Type: Application
-set-debug-mode:
-debug-obfuscation-check:
-build-setup:
[echo] Resolving Build Target for <ProjectName>...
BUILD FAILED
/opt/android-sdk-mac_x86/tools/ant/build.xml:5309 Unable to resolve project target 'android-17'
Total time: 0 seconds
Build step 'Invoke Ant' marked build as failure
Finished: FAILURE
Upvotes: 2
Views: 3925
Reputation: 173
goto your ANDROID_HOME directory and set read write permission for user with which your are tryiny. i.e.Android sdk directory. (In Jenkins case you need to give read/write permission to Jenkins user. If you are not sure with the user then set read/write permission for everyone) for e.g: In my case ANDROID_HOME= users/localUser/android_sdk_macosx 1) goto android_sdk_macosx folder and set read/write permission for this and sub-folders. or you can set it for everyone too. 2) goto jenkins and try to build again. It should work.
Upvotes: 0
Reputation: 127
I just encounter the same problem with you. But I figure it out that because I remove the build.prop,framework.aidl,sdk.properties from android-15 folder(My project denpends on it.), revert these files solves my problem.
Upvotes: 0
Reputation: 111
Oh, I finally figured it out.
I had the wrong permissions on ANDROID_HOME/platforms
Upvotes: 4