Building ant

The Corona Enterprise directory is hard coded inside of the “build.sh” file.  It’s currently set to “/Applications/CoronaEnterprise”.  So, if you decide to place your Corona Enterprise folder in a different directory, then you would need to modify that script.

Try this.  Open your “Terminal” window and then type in the following into it…

cd /Applications/CoronaEnterprise

If the terminal fails to go to that directory, then that’s your problem.  But that said, if you copied your CoronaEnterprise folder to the Applications directory, then it should be there.  In which case, perhaps you just have a bad copy/download of Corona Enterprise.  If that’s the case, then I recommend that you delete the Corona Enterprise directory, re-download it from our website, and copy it into your Applications folder again.

thanks Joshua,

I can reach that directory. I have installed the newest CoronEnterprise version but it still fails.

BUILD FAILED /Users/jannsigrist/Documents/GroohAndroidNative/App/android/build.xml:86: Execute failed: java.io.IOException: Cannot run program "${CoronaEnterpriseDir}/Corona/mac/bin/lua": error=2, No such file or directory at java.lang.ProcessBuilder.start(ProcessBuilder.java:460) at java.lang.Runtime.exec(Runtime.java:593)

any other idea?

Hi Dingo. Please complete these steps and it should resolve your issue.

  1. Update your project: 

android update project --path /project_path  --target 2

  1. Ensure you have Android 2.2 (Api 8) installed via the Android SDK manager

android_sdk_path > tools > Android

Tick the box which says “Android 2.2 (Api 8)” and then the “Install Packages” button which is located to the bottom right of the screen. You will then be asked to accept the licences, then click install.

  1. Add the following export to your bash_profile

export ANDROID_SDK=~/PATH_TO_YOUR_ANDROID_SDK

  1. Make sure you are building like this:

./build.sh android_sdk_path corona_enterprise_path

or (providing you completed step 3)

./build.sh

Providing you complete these steps you shouldn’t have any issues.

hi danny,

thanks a lot for your help! it is working now. Now I am only fighting some manifest errors.

why do i have to remove android:hardwareAccelerated=“true”?

…and it says String types not alloewd at configChanges with value keyboardHidden|orientation|screensize?

Glad to hear it’s working. Are these manifest errors coming from an untouched SimpleLuaExtension, ie not modified (I am basing testing the builds on that example) or your own app?

i think it was just a modifying of the manifest coming with the simpleluaextension file for my own game.

somehow he doesnt like the android:configChanges=“keyboardHidden|orientation|screenSize” line…

This means that your AndroidManifest.xml file contains settings that the Android API Level that you are building with does not support.  It means you need to target a higher API Level that supports the newest manifest settings that you are trying to use.

You target an API Level in an Android project in 2 places:

  • Your “project.properties” file via the “target” property.

  • Your “AndroidManifest.xml” file via the <uses-sdk> tag.

Both of the above settings must be set.  Note that if you use the “android update” command at the terminal, then it will set the target in your “project.properties” file.  I’ve noticed one little mistake in Danny’s post above which would have made your project target API Level 2 instead.  You want it to target API Level 16 like this…

   android update project --path /project_path  --target 16

Or… you could just modify the “project.properties” file by hand.

Also, in your Android SDK Manager application (included with the Android SDK), you’ll need to download every API Level that your Android project target and that its libraries (such as Corona) targets.  So, for sample project “SimpleLuaExtensions”, you’ll need to download/install API Levels 8 and 16.

You can find Google’s official documentation on how to set up Android projects here…

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

   http://developer.android.com/tools/projects/projects-cmdline.html

I hope this helps!

Joshua, Danny,

thanks a lot for your help. its all working now! and thanks for the lesson(s) on android building.

:smiley:

another noobish question, since it might help others too:

I have builded and signed with my keystore. the unsigned apk always gets named app, I have edited in the manifest but still its name is app. how can i change that?

and on the device, there is no icon and all… does this type of building ignore the build.settings from corona? if so, I guess I need to specify icons and all?

When building with the Android SDK, you set the APK file name via the <project> tag’s “name” attribute in your “build.xml” file.  For example…

\<?xml version="1.0" encoding="UTF-8"?\> \<project name="YourApkFileName" default="help"\> \<!-- The rest of your project settings go here. --\> \</project\>

Regarding application icons, you have to set that up the native Android way.  Icon files such as “Icon-mdpi.png” and “Icon-hdpi.png” are only supported by the Corona Simulator and are ignored by the Android SDK.  Native Android developers have to add application icons (aka: launcher icons) to their Android project’s “res” directory and reference that application icon file via the AndroidManifest.xml file’s <application android:icon=""> attribute as documented by Google here…

   http://developer.android.com/guide/topics/manifest/application-element.html#icon

   http://developer.android.com/design/style/iconography.html

Also, the “build.settings” file is ignored for native Android SDK builds.  The “build.settings” file is only used by the Corona Simulator.  This means you have to edit the AndroidManifest.xml file yourself.  But that said, that gives you ultimate control over how your app is configured.  Google documents how to set the AndroidManifest.xml file via the link below.  Also, our sample projects’ AndroidManifest.xml files contains comments that indicate why those tags were added, which should prove helpful.

   http://developer.android.com/guide/topics/manifest/manifest-intro.html

There is definitely a lot to learn when doing native Android development, but once you get the hang of it and all of its nuances, it’s not so bad.  That said, it also shows how easy we made Android development via the Corona Simulator.

thanks!

Hi, Joshua,

Regarding to Corona Enterprise, can you give us the same explanation you did above when using the Android SDK in reference to the XCode iOS project?

Questions about build.settings, what developers should pay attention, etc.

And you have any other tip on Android SDK, please tell us too.

Thanks.

Unfortunately, I know very little about iOS/Xcode development here.  So, I don’t know how Apple wants you to set it.  But that said, I do know that the Corona Enterprise Xcode app template that we provide does use the “build.settings” file as a pre-build or post-build step.  You can set your app name in the “plist” table and use the “CFBundleDisplayName” setting.

Hi, Joshua,

Regarding to Corona Enterprise, can you give us the same explanation you did above when using the Android SDK in reference to the XCode iOS project?

Questions about build.settings, what developers should pay attention, etc.

And you have any other tip on Android SDK, please tell us too.

Thanks.

Unfortunately, I know very little about iOS/Xcode development here.  So, I don’t know how Apple wants you to set it.  But that said, I do know that the Corona Enterprise Xcode app template that we provide does use the “build.settings” file as a pre-build or post-build step.  You can set your app name in the “plist” table and use the “CFBundleDisplayName” setting.