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

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

我有以下错误: smartmind$ ant debug Buildfile: /Users/smartmind/Works/Smallthing/cocos2d-x/samples/HelloCpp/ BUILD FAILED /Users/smartmind/Works/Smallthing/cocos2d-x/samples/HelloCpp/ sdk.dir is missing. Make sure to generate 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。


 ant debug -Dsdk.dir=$SDK_ROOT 

其中$ SDK_ROOT是android SDKpath