我得到这个错误,当我做
$ ant release
sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through an env var
打字的Android更新项目中,我得到另一个错误,说我必须指定路径....到项目中。
然后,我尝试光盘到我的项目的目录,然后
android update -p .
android update -path .
等它说-p
和-path
没有全球公认的。
可能有人只给我确切的语法?
Answer 1:
cd到项目目录并执行以下命令:字项目是命令的一部分,而不是与一个实际的项目名称所取代。 文档没有明确这一点,应该加以改进。
android update project -p .
Answer 2:
您可以使用命令行参数设置sdk.dir,如:
ant -f xyz/build.xml clean release -Dsdk.dir=/Applications/adt-bundle-mac/sdk/
Answer 3:
您可以使用sdk.dir
在projet.properties文件中定义的SDK家庭或使用环境变量(更灵活的团队工作)。
export ANDROID_HOME=<the path to your sdks>
Answer 4:
您可以注入ANDROID_HOME
环境变量到sdk.dir
使用下列财产ant
命令。
$ ant debug -Dsdk.dir=$ANDROID_HOME
ANDROID_HOME
必须是绝对路径,如/Users/jameswald/Development/android-sdk-macosx
。
Answer 5:
我有同样的问题。 使用命令行挥舞着周围的命令后了几分钟,我最终只是编辑local.properties
直接文件。
你应该有一个名为local.properties内的
<app-directory>\platforms\android
夹。 如果你没有一个那么你可以创建它。
在文件中应该有一个指定地方蚂蚁可以找到你的Android SDK中的参考。 它应该是这样的:
sdk.dir=C:\\<path-to-sdk>\\sdk
只要更新您的详细信息将其指向了正确的Android SDK文件夹。
双\存在于我的文件。 不知道为什么,但它似乎工作。 :)
注意:这个文件还需要被复制到你的CordovaLib
文件夹,这是一个文件夹更深: <app-directory>\platforms\android\CordovaLib
Answer 6:
这应该创建/修复从蚂蚁local.properties:
Android的更新项目--name --target --path
名称参数是可选
目标是API版本
这里更多信息https://developer.android.com/tools/projects/projects-cmdline.html#UpdatingAProject
Answer 7:
android update project -p .
可能解决您的问题。 有时候,当你执行android update project -p .
你可能最终与O / P筛选。
Updated local.properties
----------
build.xml: Failed to find version-tag string. File must be updated.
In order to not erase potential customizations, the file will not be automatically regenerated.
If no changes have been made to the file, delete it manually and run the command again.
If you have made customizations to the build process, the file must be manually updated.
It is recommended to:
* Copy current file to a safe location.
* Delete original file.
* Run command again to generate a new file.
* Port customizations to the new file, by looking at the new rules file
located at <SDK>/tools/ant/build.xml
* Update file to contain
version-tag: custom
to prevent file from being rewritten automatically by the SDK tools.
----------
Updated file ./proguard-project.txt
It seems that there are sub-projects. If you want to update them
please use the --subprojects parameter.
如果是的话试试这个命令android update project -p . -s
android update project -p . -s
Answer 8:
在ANDROID_HOME必须在正确的范围内设置 - 只要你有它如对当您通过点击图标(.bashrc中没有按未得到执行,然后启动您的.bashrc并不意味着变量被设置 - 但是当检查,如果的环境变量设置在控制台上它是)
你也可以把它放在studio.sh:
#!/bin/sh
#
# ---------------------------------------------------------------------
# Android Studio startup script.
# ---------------------------------------------------------------------
#
export ANDROID_HOME=/home/ligi/bin/android-sdk/
message()
{
Answer 9:
我有同样的问题,事实证明,由于某种原因,ant脚本中的一个被引用硬编码路径C:\ant
和蚂蚁我在C:\apache-ant-{version}
它不能找到它。 重命名后的蚂蚁目录,一切运行良好。
作为参考,我发现这个问题的文件是\apache-ant-{version}\bin\ant.bat
:行106
编辑:我使用Windows 8
Answer 10:
是啊,这些解决方案为我工作。 这确实从这里:
设置ANDROID_HOME ENVIROMENTAL变量在Mac OS X
打开终端窗口,输入以下内容(我希望这是SDK的完整路径):
出口ANDROID_HOME = /应用/ ADT / SDK一旦你有了这一套,你需要把它添加到PATH环境变量
出口PATH = $ PATH:$ ANDROID_HOME /箱
文章来源: SDK.DIR is missing? android update project?