I want to use the ${sdk.dir}
variable in my project.properties file, so I can check this into version control and use the same file on different setup machines.
My working setup looks like this:
My project.properties:
target=android-18
android.library.reference.1=..\\..\\..\\sdk\\extras\\android\\support\\v7\\appcompat
android.library.reference.2=..\\..\\..\\sdk\\extras\\google\\google_play_services\\libproject\\google-play-services_lib
My local.properties:
sdk.dir=C:\\adt-bundle-windows-x86_64-20130917\\sdk
this setup compiles with ant from the command line. but when I replace the ..\\..\\..\\
with ${sdk.dir}
I get the error:
project.properties how I want it to use:
target=android-18
android.library.reference.1=${sdk.dir}\\extras\\android\\support\\v7\\appcompat
android.library.reference.2=${sdk.dir}\\extras\\google\\google_play_services\\libproject\\google-play-services_lib
results in:
BUILD FAILED
C:\adt-bundle-windows-x86_64-20130917\sdk\tools\ant\build.xml:460:
Failed to resolve library path:
C:\adt-bundle-windows-x86_64-20130917\sdk\extras\android\support\v7\appcompat
so the variable ${sdk.dir}
is replaced correctly but somehow it cannot be resolved. Any ideas?
update Edit
Using the Variable for the proGuard setup in the same file (project.properties
) is working fine what so ever:
proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
This doesn't solve your issue, per se, but I hope it will help you.
My issue was that I needed to reference the Google Play Services SDK as a library in my project. However, our app is built automatically on a separate box using Ant.
I found that library projects cannot be referenced using absolute paths; they must be relative to your project, as explained here:
Library project storage location
There are no specific requirements on where you should store a library project, relative to a dependent application project, as long as the application project can reference the library project by a relative link. What is important is that the main project can reference the library project through a relative link.
I used the ant.properties
file to set the android.library.reference.1=../../../../Program Files/Android/android-sdk/Android/android-sdk/extras/google/google_play_services/libproject/google-play-services_lib
library. This reference is solely for the build server and this path is relative to the library location on the build server.
For development, I use Eclipse. So, the library's relative path is referenced using the project.properties
file and is relative to my development box. This means that whenever I trigger a build on the server (which uses Ant), the reference in the ant.properties
is used as opposed to the project.properties
file.
The ant.properties
file is lower level and therefore will override anything written in the project.properties
/local.properties
files.
As you can see this is not the answer I am sure you're looking for, but it is a limitation of Ant. My final bit of advice is that you move away from Ant and use Gradle.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With