antdebugging和sdk.dir

我有一个问题来生成Android APK文件。

当我运行ant debug编译工作正常,但是当我运行ant debug

我有以下错误:

 iMac:proj.android smartmind$ ant debug Buildfile: /Users/smartmind/Works/Smallthing/cocos2d-x/samples/HelloCpp/proj.android/build.xml BUILD FAILED /Users/smartmind/Works/Smallthing/cocos2d-x/samples/HelloCpp/proj.android/build.xml:46: sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through an env var Total time: 0 seconds 

我不知道是什么问题。

Solutions Collecting From Web of "antdebugging和sdk.dir"

您的项目应该有一个带有sdk.dir行的local.properties文件,该行指向您的Android SDK的安装位置:

 # 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_x86 

要创build该文件,如果它不存在,请运行android update project -p ...其中...是项目的path。

我有同样的问题,我使用-Dvar或VM参数来解决问题。

 ant debug -Dsdk.dir=$SDK_ROOT 

其中$ SDK_ROOT是android SDKpath