如何解决';sdk.dir缺失';使用ant构建android项目时出错

如何解决';sdk.dir缺失';使用ant构建android项目时出错,android,ubuntu,ant,sdk,build.xml,Android,Ubuntu,Ant,Sdk,Build.xml,当我在窗口中的命令行中创建build.xml时,(android update project-p.-n myapp),那么“init”、“clean”和“build”目标名称基本上都是在build.xml中创建的 但是在ubuntu中创建build.xml时 在build.xml代码之后,缺少sdk.dir。 本地物业 # This file is automatically generated by Android Tools. # Do not modify this file --

当我在窗口中的命令行中创建build.xml时,(android update project-p.-n myapp),那么“init”、“clean”和“build”目标名称基本上都是在build.xml中创建的

但是在ubuntu中创建build.xml时

在build.xml代码之后,缺少sdk.dir。


本地物业

# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.

# location of the SDK. This is only used by Ant
# For customization when using a Version Control System, please read             the
# header note.
sdk.dir=/opt/android-sdk-linux
我不知道怎样才能解决这个问题


请帮我解决这个问题

仔细检查您的构建框中是否下载了Android SDK。在您的例子中,看起来它在/opt/android SDK linux中查找SDK。因此,请确保它在那里可用

转到Jenkins>管理Jenkins>配置系统 勾选“环境变量” 添加名称:ANDROID_HOME,value->您的ANDROID SDK在jenkins构建框中的位置

点击保存

重新构建作业。将生成一个local.properties文件,并填充sdk.dir字段

js@js-W65-67SH:~$ echo $ANDROID_HOME
/opt/android-sdk-linux
js@js-W65-67SH:~$ 
js@js-W65-67SH:~$ echo $PATH
/home/js/.nvm/versions/node/v0.12.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/opt/android-sdk-linux/tools:/opt/android-sdk-linux/platform_tools
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.

# location of the SDK. This is only used by Ant
# For customization when using a Version Control System, please read             the
# header note.
sdk.dir=/opt/android-sdk-linux