Building Android projects that reference library projects with ANT

16,144

Solution 1

I found a solution to that:

When making the instruction of adding to library folder, try to do it with a relative path like this:

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

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

Solution 2

I think the command may have moved from lib-project to project. Try the following instead.

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

The example you gave omitted the target number. You can also update the target if you provide a valid target number. As you probably already know, you can see a list of valid targets using the following command.

android list targets
Share:
16,144
Admin
Author by

Admin

Updated on June 06, 2022

Comments

  • Admin
    Admin almost 2 years

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

    I have been using the steps on the Managing Projects from the Command Line on the Android Developers site to build using ANT. My project references another library project, so I've been using:

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

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

    Recently I updated my sdk tools to rev 10, platform-tools rev 3. The first thing I ran into is that it seems the --library flag is missing. I noticed the 'update project' now has a --library option, so I assume I should be using that command now to update projects that reference libraries.

    Problem is that although the default.properties, local.properties and build.xml files all look good for the library and the application, running ant.bat build.xml on the app that references the library project now fails with "Failed to resolve library path" followed by the path it is trying to resolve, which is indeed the right path.

    Even if I don't use 'update project' and revert to the default.properties, local.properties and build.xml files that used to work for ant.bat build.xml, it still fails with this same error since the sdk update.

    Any advice would be greatly appreciated. Thanks! Scott