我有一个问题来生成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 


  • 使用math函数中的值在cocos2d-x中渲染
  • “无法在cocos2dx应用程序中find导入路径中带有'CocosDenshion / android'标签的模块”错误
  • 在主线程上运行回调
  • 最完整的Cocos2d-x教程和指南列表
  • Cocos2d-x:如何将使用XCode开发的Cocos2d-x项目移植到Android(通过Eclipse)?
  • 获取软键盘的尺寸
  • “在cocos2dx应用程序中的错误”无法find具有标签的模块“CocosDenshion / android'in import path”错误
  • 您的项目应该有一个带有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