ossys
ossys

Reputation: 4217

Android Jenkins Build - debug "target" does not exist in the project error

I set up a Jenkins server along with the Android SDK on a headless Linux build server. I create an Android project via the typical "android create project ..." command.

After I "cd" into the new project, I can "ant clean debug" successfully as the jenkins user on the command line. I am running this from my Jenkins workspace directory (.jenkins/workspace/<project name>):

# su jenkins
$ ant clean debug
.... successful ....

However, when the Jenkins job builds I get a Target "debug" does not exist in the project "ProjectName" error

I set the sdk.dir variable to my Android SDK directory, so the command in the Jenkins log runs like:

$ ant -Dsdk.dir=/opt/java/android clean debug

I've set my permissions to 777 on the entire android SDK folder:

# chmod -R 777 /usr/java/android/android-sdk

I'm at a loss for what else I might be missing? Why would the command run on the command line but be unsuccessful as a Jenkins job?

Thanks!

Upvotes: 3

Views: 4757

Answers (3)

Hari Tyagi
Hari Tyagi

Reputation: 51

I also got same issue. However breaking my head for a while i was able fix the issue. So if you want to run ant target on the command line, you have to use "ant target name"(e.g. ant debug). But to run same target by jenkin you should use only target name without ant(e.g. debug).

Not sure why it is so. But this resolved the issue for me.

Upvotes: 0

ossys
ossys

Reputation: 4217

After a couple days of frustration and wonder, it turns out that deleting the project and re-creating it with the EXACT same settings fixed the issue. In the mean time, I created and deleted several more jobs, and sometimes they have the error mentioned above, and sometimes they don't. Even with the exact same settings for the Job (letter for letter), it works at times and others it does not. I'm sorry I do not know how to fix this issue other than, delete the Job, recreate it, and try again!

Best of luck!

Upvotes: 0

Shellum
Shellum

Reputation: 3179

Are you running the command line ant build from the same place that jenkins is trying to?

Double check your

.jenkins/workspace/<project-name>

directory to make sure it has the same project files as where you're running things from the command line manually.

Upvotes: 2

Related Questions