Creating Android projects that reference library projects using ANT

After updating my sdk tools, I cannot build my project from the command line.

I used the Project Management steps from the command line on the Android developer site to create using ANT. My project refers to another library project, so I used:

android update lib-project --target <target_ID> --path path/to/your/project --library path/to/library_projectA 

update default.properties , local.properties and build.xml and ant.bat build.xml to build .apk . This worked without any problems for some time.

I recently upgraded my sdk tools to version 10, platform tools rev 3. The first thing I came across was that the --library flag --library missing. I noticed that the “update project” now has the --library , so I guess now I have to use this command to update projects that reference libraries.

The problem is that although the default.properties , local.properties and build.xml files look good for the library and the application, running ant.bat build.xml in the application that references the library project now fails with "Could not resolve library path, ”followed by the path that he is trying to resolve, and that’s really the right path.

Even if I do not use the “update project” and do not return to the default.properties , local.properties and build.xml files that used to work for ant.bat build.xml , it still fails with the same error as the update sdk.

Any advice would be greatly appreciated. Thank you Scott

+7
source share
2 answers

I found a solution for this:

When creating instructions for adding to a library folder, try to do this with a relative path as follows:

Android update project --target 3 --path c: / Absolute / Path / Of / Project --library ../ actionbar (relativePathOfLibrary)

I found the same problem as you, but this way it worked fine.

+8
source

I think the team may have moved from the lib-project project to the project. Instead, try the following.

 android update project --path path/to/your/project --library path/to/library_projectA 

In the example you specified, the target number is omitted. You can also update the target if you have a valid target number. As you probably already know, you can see a list of acceptable goals using the following command.

 android list targets 
+4
source

All Articles