Can't build for Android. (OS X Mavericks)

Hi,

I’m trying to build my game with Enterprise and get Android build:

  1. I have my Android SDK in my path and can access it from anywhere in Terminal but how can I store it in ANDROID_SDK variable name that build.sh file expects?

  2. When I try to build the sample project of “SimpleLuaExtension” with this:

    ./build.sh “/Users/<username>/<path_to_sdk>/android-sdk-macosx”

it returns:

CORONA\_PATH: ../../.. Error: The project either has no target set or the target is invalid. Please provide a --target to the 'android update' command. Updated local.properties Updated file ../../../Corona/android/lib/Corona/proguard-project.txt Updated local.properties Updated file ../../../Corona/android/lib/facebook/facebook/proguard-project.txt Using Corona Enterprise Dir: ../../.. ./build.sh: line 95: ant: command not found Exiting due to errors (above)
  1. Is it due to the fact that it cannot find ant? I’m asking this because it returns several errors before saying that it cannot find ant.

I searched around and found topics that people on Mavericks apparently had to install ant manually due to it’s removal from Mavericks but they reported problems even doing so, but it seems it’s a known problem with Mavericks.

  1. I don’t think that I have JDK, do I need to install it? If yes, which version and which architecture.

  2. I even downloaded Eclipse for Java Developers, 32-bit", is this easier to do with it?

Thanks.
 

I’m on OS X Mavericks with I don’t know which version of Enterprise but I reckon to be fairly new.

With Corona Enterprise, you are not building with Corona anymore.  You are building with the Android SDK.  Corona Enterprise includes Android libraries which you would include into your own Android application project.  So, you’ll need to learn the fundamentals of native Android development first.

So, first, I recommend that you learn how to build the sample projects that are included with Google’s Android SDK.  That’ll help teach you how to use Google’s Android SDK build system.  Especially since it sounds like your development environment is not set up correctly.  I suspect that you haven’t downloaded the API Levels needed by our sample projects within the Android SDK Manager.  Corona’s sample projects require API Levels 16 and 8 to be installed.  You determine what API Level need to be installed based on what is required in your application’s “AndroidManifest.xml” file and all of the Android library projects.  Hence, if the Android Facebook SDK requires a different API Level and you want to include it in your project, then you’ll need to download that API Level via the SDK Manager too.

How to do the above is all documented on Google’s end.

   http://developer.android.com/tools/help/sdk-manager.html

   http://developer.android.com/tools/projects/index.html

Also note that the Android SDK requires the 32-bit version of JDK 6, which is not installed on OS X Mavericks by default, but I believe you can force OS X to install it by just doing an Android build from the Corona Simulator.  There’s probably another way to do it, but I know OS X will prompt you in that case.

Thanks Joshua.

I do have Android SDK and while I’m reading the links you posted, I would appreciate if you, or anyone else, would answer my questions.

Cheers.

I pretty much gave you the solution.  You’re likely missing the API Levels needed to build the sample apps.  The Android SDK that you’ve downloaded and installed does not include everything needed to build an Android app.  You have to open the “Android SDK Manager” window and check on each API Levels needed (8 and 16) to be download by the Android SDK.  That should fix the compiler error that you are seeing.  The first link I gave you up above shows you how to do this.

Odds are you already have the JDK installed.  The JDK comes with ant… and yes, both the JDK and ant is required to do Android SDK builds.  But like I said, it sounds like you already have them installed, otherwise you wouldn’t have gotten as far in the build process as you did.  I only recommended that you build the sample projects that come with the Android SDK because they’re simpler and to verify that your development environment is set up correctly.

ant isn’t included in Mavericks. You’ll need to install it before you can build for Android.

I use MacPorts (http://www.macports.org) to install packages.

After installing MacPorts, you can install ant by issuing the command:

sudo port install apache-ant

I’m pretty sure that the Mac version of the JDK comes with ant.  If you can successfully build an Android app with the Corona Simulator, then that proves that the JDK and ant is installed and working.

I still think that the real problem here is that those API Levels are not installed in the Android SDK.  I’ve seen those build error messages before and that’s usually what they indicate.

Hi,

I did not have API level 16 and I installed it.

I tried to build and this happened:

CORONA\_PATH: ../../.. Updated local.properties build.xml: Found version-tag: custom. File will not be updated. Updated file ./proguard-project.txt Updated local.properties Updated file ../../../Corona/android/lib/Corona/proguard-project.txt Updated local.properties Updated file ../../../Corona/android/lib/facebook/facebook/proguard-project.txt Using Corona Enterprise Dir: ../../.. ./build.sh: line 95: ant: command not found Exiting due to errors (above)

So is it ant then?

Hi,

I did not have API level 16 and I installed it.

I tried to build and this happened:

CORONA\_PATH: ../../.. Updated local.properties build.xml: Found version-tag: custom. File will not be updated. Updated file ./proguard-project.txt Updated local.properties Updated file ../../../Corona/android/lib/Corona/proguard-project.txt Updated local.properties Updated file ../../../Corona/android/lib/facebook/facebook/proguard-project.txt Using Corona Enterprise Dir: ../../.. ./build.sh: line 95: ant: command not found Exiting due to errors (above)

So is it ant then?

Looks like ant isn’t installed.

What I did was install Brew: www.brew.sh
Then when brew is installed run: brew update
Then run: brew install ant

(All from the terminal)

And you should be good to go

Yes! 

Danny scores one for the Home team!  :slight_smile:

With Corona Enterprise, you are not building with Corona anymore.  You are building with the Android SDK.  Corona Enterprise includes Android libraries which you would include into your own Android application project.  So, you’ll need to learn the fundamentals of native Android development first.

So, first, I recommend that you learn how to build the sample projects that are included with Google’s Android SDK.  That’ll help teach you how to use Google’s Android SDK build system.  Especially since it sounds like your development environment is not set up correctly.  I suspect that you haven’t downloaded the API Levels needed by our sample projects within the Android SDK Manager.  Corona’s sample projects require API Levels 16 and 8 to be installed.  You determine what API Level need to be installed based on what is required in your application’s “AndroidManifest.xml” file and all of the Android library projects.  Hence, if the Android Facebook SDK requires a different API Level and you want to include it in your project, then you’ll need to download that API Level via the SDK Manager too.

How to do the above is all documented on Google’s end.

   http://developer.android.com/tools/help/sdk-manager.html

   http://developer.android.com/tools/projects/index.html

Also note that the Android SDK requires the 32-bit version of JDK 6, which is not installed on OS X Mavericks by default, but I believe you can force OS X to install it by just doing an Android build from the Corona Simulator.  There’s probably another way to do it, but I know OS X will prompt you in that case.

Thanks Joshua.

I do have Android SDK and while I’m reading the links you posted, I would appreciate if you, or anyone else, would answer my questions.

Cheers.

I pretty much gave you the solution.  You’re likely missing the API Levels needed to build the sample apps.  The Android SDK that you’ve downloaded and installed does not include everything needed to build an Android app.  You have to open the “Android SDK Manager” window and check on each API Levels needed (8 and 16) to be download by the Android SDK.  That should fix the compiler error that you are seeing.  The first link I gave you up above shows you how to do this.

Odds are you already have the JDK installed.  The JDK comes with ant… and yes, both the JDK and ant is required to do Android SDK builds.  But like I said, it sounds like you already have them installed, otherwise you wouldn’t have gotten as far in the build process as you did.  I only recommended that you build the sample projects that come with the Android SDK because they’re simpler and to verify that your development environment is set up correctly.

ant isn’t included in Mavericks. You’ll need to install it before you can build for Android.

I use MacPorts (http://www.macports.org) to install packages.

After installing MacPorts, you can install ant by issuing the command:

sudo port install apache-ant

I’m pretty sure that the Mac version of the JDK comes with ant.  If you can successfully build an Android app with the Corona Simulator, then that proves that the JDK and ant is installed and working.

I still think that the real problem here is that those API Levels are not installed in the Android SDK.  I’ve seen those build error messages before and that’s usually what they indicate.

Hi,

I did not have API level 16 and I installed it.

I tried to build and this happened:

CORONA\_PATH: ../../.. Updated local.properties build.xml: Found version-tag: custom. File will not be updated. Updated file ./proguard-project.txt Updated local.properties Updated file ../../../Corona/android/lib/Corona/proguard-project.txt Updated local.properties Updated file ../../../Corona/android/lib/facebook/facebook/proguard-project.txt Using Corona Enterprise Dir: ../../.. ./build.sh: line 95: ant: command not found Exiting due to errors (above)

So is it ant then?

Hi,

I did not have API level 16 and I installed it.

I tried to build and this happened:

CORONA\_PATH: ../../.. Updated local.properties build.xml: Found version-tag: custom. File will not be updated. Updated file ./proguard-project.txt Updated local.properties Updated file ../../../Corona/android/lib/Corona/proguard-project.txt Updated local.properties Updated file ../../../Corona/android/lib/facebook/facebook/proguard-project.txt Using Corona Enterprise Dir: ../../.. ./build.sh: line 95: ant: command not found Exiting due to errors (above)

So is it ant then?

Looks like ant isn’t installed.

What I did was install Brew: www.brew.sh
Then when brew is installed run: brew update
Then run: brew install ant

(All from the terminal)

And you should be good to go

Yes! 

Danny scores one for the Home team!  :slight_smile:

Same problem here. Resolved using Danny solution (installing ant via Homebrew).