ant debug, and sdk.dir
Asked Answered
W

2

9

I have a problem to generate the Android APK file.

When I run ant debug compilation work fine, but when I run ant debug

I have following error:

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

I don't know what is problem.

Womble answered 9/11, 2012 at 16:8 Comment(0)
M
17

Your project should have a local.properties file with an sdk.dir line that points to where your Android SDK is installed:

# 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

To create this file if it does not exist, run android update project -p ... where the ... is the path to your project.

Mineraloid answered 9/11, 2012 at 17:37 Comment(5)
yes I have this file created with "android update project -t android-16 -p . # 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=/Users/smartmind/Works/SDK/Android/sdkWomble
BUILD FAILED /Users/smartmind/Works/SDK/Android/sdk/tools/ant/build.xml:569: The following error occurred while executing this line: /Users/smartmind/Works/Smallthing/cocos2d-x/cocos2dx/platform/android/java/build.xml:46: sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through an env varWomble
@lordubik: Beyond making sure that you are on the latest edition of the Android tools, and making sure that the value of sdk.dir is indeed correct, I have no recommendation.Mineraloid
the android tools are updated with AVD Manager and the sdk.dir is set to Android SDK root. (/Works/Android/sdk)Womble
ok, resolved with this syntax: ant -Dsdk.dir=$ANDROID_HOME -Dtarget=android-16 debug. Thanks anyway for your help!Womble
S
14

i had the same problem, i resolve the issue using a -Dvar or VM argument.

ant debug -Dsdk.dir=$SDK_ROOT

where $SDK_ROOT is android SDK path

Selfloading answered 21/4, 2013 at 16:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.