Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ant build Android project with dependency lib

I have two Android projects, one shared library and the app. Now I want to compile the app with dependency to the library. In Eclipse, it works very well. After that, I upload it via git to my repository and trigger Jenkins to build both projects.

My problem is, that the error occurs: "sdk/android-sdk-linux/tools/ant/build.xml:440: ../shared-lib resolve to a path with no project.properties file for project". That's clear, because in Jenkins the jobs are stored different than under Eclipse.

Another problem is, that Eclipse compiled the shared to ".jar" and Ant compiled it to "classes.jar" (is named in sdk/android-sdk-linux/tools/ant/build.xml).

like image 384
mars3142 Avatar asked Feb 11 '12 09:02

mars3142


2 Answers

Ant scripts should allow you to include whatever files you need. In your case I will suggest you move the reference to the shared-lib to local.properties file (this file should also be read by the ant script generated by update-project. Keep the adequate path for jenkins in the repository and modify the file locally for the local built. In the file in the repository you will need to have something like:

android.library.reference.1=../classes.jar 

EDIT By the way the suggestion of the second properties file is just because this file is really meant to store location-specific properties.

like image 106
Boris Strandjev Avatar answered Oct 14 '22 16:10

Boris Strandjev


I fixed it with copy files. The first project builds my shared-lib.jar. The other projects (phone and tablet) copy this file (shared-lib.jar) to there libs-folder and build correctly. But now I have different projects.propertieson the server and my dev-client. This one is not checked in into git.

like image 40
mars3142 Avatar answered Oct 14 '22 17:10

mars3142