Skip to content

Commit 7b15fc9

Browse files
committed
Use ANDROID_HOME environment variable if available, and warn user if neither that nor sdk.dir is set correctly.
1 parent 9272f3e commit 7b15fc9

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

build.xml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,19 @@
2626
</target>
2727

2828
<!-- Standard jar stuff -->
29-
<property name="lib.dir" value="${sdk.dir}/platforms/${target}" />
29+
<property environment="env"/>
30+
<condition property="android.base" value="${sdk.dir}" else="${env.ANDROID_HOME}">
31+
<isset property="sdk.dir" />
32+
</condition>
33+
<fail message="Please set either the sdk.dir property or the ANDROID_HOME environment variable to point to your Android SDK installation.">
34+
<condition>
35+
<not>
36+
<available file="${android.base}" type="dir"/>
37+
</not>
38+
</condition>
39+
</fail>
40+
41+
<property name="lib.dir" value="${android.base}/platforms/${target}" />
3042
<property name="build.dir" value="./build"/>
3143
<property name="classes.dir" value="${build.dir}/classes"/>
3244
<buildnumber file="build.num" />
@@ -43,7 +55,7 @@
4355
sourcepath="gen:src"
4456
destdir="doc"
4557
packagenames="${package.packagename}"
46-
linkoffline="http://d.android.com/reference ${sdk.dir}/docs/reference"
58+
linkoffline="http://d.android.com/reference ${android.base}/docs/reference"
4759
additionalparam="-author -version"
4860
/>
4961
</target>

0 commit comments

Comments
 (0)