Error running for Android

Hi,

I want to build a corona enterprise project for android, it builds successfully, but it doesn’t run.

I am trying with the sample App template from the Enterprise folder and this is the error I get when running it

02-02 23:30:11.851: E/Trace(740): error opening trace file: No such file or directory (2) 02-02 23:30:12.561: W/EGL\_emulation(740): eglSurfaceAttrib not implemented 02-02 23:30:13.110: W/EGL\_emulation(740): eglSurfaceAttrib not implemented

I don’t know if it is related but in order to have the project building I had to fix the path to corona in the project properties, otherwise it had errors and didn’t build. In the snapshots I detail the changes.

I buld with ADT (Eclipse) v22.3.0

The target device is a Galaxy Nexus emulator with openGL enabled.

The corona enterprise build is 2013.1244

Notice that the project does work nicely for iOS

Edit:

I also tried to run it in a real device with no success.

I tested the adt emulator with an app built with corona pro successfully.

Thanks,

Ernest

Corona Enterprise’s “App Template” for Android is more of a plugin template.

I suggest that you follow the Android examples under the “Samples” directory, such as “SimpleLuaExtensions” or “ExtendingUI”.  Also, the “IncludeAllFeatures” sample project is a good example on how to include 3rd party libraries into your Android application project, such as the Facebook library and Flurry.

I tried with the “SimpleLuaExtensions” sample as you suggested with the exact same result.

Considering this and the fact I already tried another project of my own also with the same result: it looks like my problem does not depend on which particular project I use.

What else can I do?

I see you are trying to use Eclipse, which is a bit more complex.  It sounds like Corona’s libraries are not being included into your Android application project.  First, I would recommend that you try to build a sample app the “easy” way via “ant”, which is what Eclipse and the ADT plugin uses to build an Android app.

Please do the following:

  1. Open a “Terminal” window.
  2. “cd” to one of the Android projects under Corona Enterprise sample projects directory.
  3. For example:  “cd <CoronaEnterpriseDir>/Samples/SimpleLuaExtension/android”
  4. Run the “build.sh” script to build the Android app.  You’ll need to pass the path to your Android SDK’s root directory as the first argument.
  5. For example:  “./build.sh <PathToYourAndroidSdk>”
  6. Next, you’ll need to digitally sign the built APK.  If you sign it with a “debug.keystore”, then should be as follows…
  7. Example:  “jarsigner -keystore <PathToDebugKeystore> <PathToUnsignedApk> androiddebugkey”
  8. Password:  “android”
  9. Install and run the signed APK onto your Android device.

Here are some additional notes:

  • The Android SDK will generate a “debug.keystore” file under the “~/.android” directory.

  • The Corona SDK (the SDK that includes the Corona Simulator) contains a “debug.keystore” as well that you can use.

  • Eclipse and ADT might have modified some of the sample project files when you attempted to build them.  Particularly the “project.properties” file.  You might have to revert to what you originally downloaded.

- In order to build for Eclipse, you will have to modify the “build.xml” file at the bottom.  There is a “CoronaEnterpriseDir” ant property that you need to replace with the path to where you keep “Corona Enterprise”.  Note that the “build.sh” script sets this variable at the bottom.  You’ll need to set it to that path.

  • In Eclipse, you’ll also have to reference the Corona “Android library project” so that it’ll be included when you build your app.  I haven’t used Eclipse in a year and don’t remember how to do this, but there are plenty of examples on the Internet how.

The above should help get you started.

The key thing to remember here is that you are no longer building with Corona.  You are building with the Android SDK now and Corona is just a library that you integrate into your own Android application project.  What we’re doing is pretty standard compared to other libraries, except for the pre/post-build steps that is needed to compile your Lua scripts and copy them into your assets directory.  Those steps can be seen in the “build.xml” which ant and Eclipse uses.

igenapps, I got your response, but for some reason it didn’t get posted to this forum thread.

It sounds like the real problem that you are having is that “ant” isn’t installed or installed at a location that the Android SDK can find it.  Are you able to run “ant” at the Terminal’s command line at all?  Just type “ant” at the terminal to see if that tool gets executed.  If not, then that’s the problem.

If “ant” is reachable, then next I would suggest that you try to build a simple sample project that is included with Google’s Android SDK.  This is to prove that your Android and JDK development environment is set up correctly.

If you’re able to build and run one of Google’s sample projects successfully, then next we have to double check that your Corona Enterprise directory is set up correctly according to the ReadMe instructions within the root directory of Corona Enterprise.  Currently, all of the “build.sh” scripts for the sample projects are hard coded to find the Corona Enterprise folder at “~/Applications/CoronaEnterprise”.  If you Corona Enterprise folder is not at that location, then I suggest that you move it there before considering changing the script’s paths.

I hope the above helps you out.

Joshua,

Thanks for your support.

I deleted my post in purpose because I managed later to make some progress.

I upgraded Corona Enterprise and managed to build sample projects with ant and from the terminal, not yet from eclipse. Apparently something got corrupted in my installation of Corona Enterprise.

Now I am moving to build my own project which I expect may be a bit more complex because I require many plugins on it. I will post if I encounter any problems.

ErnestB.

Corona Enterprise’s “App Template” for Android is more of a plugin template.

I suggest that you follow the Android examples under the “Samples” directory, such as “SimpleLuaExtensions” or “ExtendingUI”.  Also, the “IncludeAllFeatures” sample project is a good example on how to include 3rd party libraries into your Android application project, such as the Facebook library and Flurry.

I tried with the “SimpleLuaExtensions” sample as you suggested with the exact same result.

Considering this and the fact I already tried another project of my own also with the same result: it looks like my problem does not depend on which particular project I use.

What else can I do?

I see you are trying to use Eclipse, which is a bit more complex.  It sounds like Corona’s libraries are not being included into your Android application project.  First, I would recommend that you try to build a sample app the “easy” way via “ant”, which is what Eclipse and the ADT plugin uses to build an Android app.

Please do the following:

  1. Open a “Terminal” window.
  2. “cd” to one of the Android projects under Corona Enterprise sample projects directory.
  3. For example:  “cd <CoronaEnterpriseDir>/Samples/SimpleLuaExtension/android”
  4. Run the “build.sh” script to build the Android app.  You’ll need to pass the path to your Android SDK’s root directory as the first argument.
  5. For example:  “./build.sh <PathToYourAndroidSdk>”
  6. Next, you’ll need to digitally sign the built APK.  If you sign it with a “debug.keystore”, then should be as follows…
  7. Example:  “jarsigner -keystore <PathToDebugKeystore> <PathToUnsignedApk> androiddebugkey”
  8. Password:  “android”
  9. Install and run the signed APK onto your Android device.

Here are some additional notes:

  • The Android SDK will generate a “debug.keystore” file under the “~/.android” directory.

  • The Corona SDK (the SDK that includes the Corona Simulator) contains a “debug.keystore” as well that you can use.

  • Eclipse and ADT might have modified some of the sample project files when you attempted to build them.  Particularly the “project.properties” file.  You might have to revert to what you originally downloaded.

- In order to build for Eclipse, you will have to modify the “build.xml” file at the bottom.  There is a “CoronaEnterpriseDir” ant property that you need to replace with the path to where you keep “Corona Enterprise”.  Note that the “build.sh” script sets this variable at the bottom.  You’ll need to set it to that path.

  • In Eclipse, you’ll also have to reference the Corona “Android library project” so that it’ll be included when you build your app.  I haven’t used Eclipse in a year and don’t remember how to do this, but there are plenty of examples on the Internet how.

The above should help get you started.

The key thing to remember here is that you are no longer building with Corona.  You are building with the Android SDK now and Corona is just a library that you integrate into your own Android application project.  What we’re doing is pretty standard compared to other libraries, except for the pre/post-build steps that is needed to compile your Lua scripts and copy them into your assets directory.  Those steps can be seen in the “build.xml” which ant and Eclipse uses.

igenapps, I got your response, but for some reason it didn’t get posted to this forum thread.

It sounds like the real problem that you are having is that “ant” isn’t installed or installed at a location that the Android SDK can find it.  Are you able to run “ant” at the Terminal’s command line at all?  Just type “ant” at the terminal to see if that tool gets executed.  If not, then that’s the problem.

If “ant” is reachable, then next I would suggest that you try to build a simple sample project that is included with Google’s Android SDK.  This is to prove that your Android and JDK development environment is set up correctly.

If you’re able to build and run one of Google’s sample projects successfully, then next we have to double check that your Corona Enterprise directory is set up correctly according to the ReadMe instructions within the root directory of Corona Enterprise.  Currently, all of the “build.sh” scripts for the sample projects are hard coded to find the Corona Enterprise folder at “~/Applications/CoronaEnterprise”.  If you Corona Enterprise folder is not at that location, then I suggest that you move it there before considering changing the script’s paths.

I hope the above helps you out.

Joshua,

Thanks for your support.

I deleted my post in purpose because I managed later to make some progress.

I upgraded Corona Enterprise and managed to build sample projects with ant and from the terminal, not yet from eclipse. Apparently something got corrupted in my installation of Corona Enterprise.

Now I am moving to build my own project which I expect may be a bit more complex because I require many plugins on it. I will post if I encounter any problems.

ErnestB.

@Joshua,

Could you please take a look a this post: http://forums.coronalabs.com/topic/45547-failed-to-include-zip-library-ios/

I am having a problem very similar to this one, but the same solution that worked for the other plugins is not working for the zip plugin and I can’t understand why.

Thanks!

I’m not an iOS developer here and don’t know the answer… but I imagine you would have to statically link the zip library’s *.a file into your app project just like how it is done in our app template projects included in Corona Enterprise.  Those app template demonstrate how to create a separately plugin library and statically link them into the app.  Now, how to do that in Xcode would be covered in Apple’s documentation, because this really isn’t a Corona related question.  It’s an Xcode question.

@Joshua,

Could you please take a look a this post: http://forums.coronalabs.com/topic/45547-failed-to-include-zip-library-ios/

I am having a problem very similar to this one, but the same solution that worked for the other plugins is not working for the zip plugin and I can’t understand why.

Thanks!

I’m not an iOS developer here and don’t know the answer… but I imagine you would have to statically link the zip library’s *.a file into your app project just like how it is done in our app template projects included in Corona Enterprise.  Those app template demonstrate how to create a separately plugin library and statically link them into the app.  Now, how to do that in Xcode would be covered in Apple’s documentation, because this really isn’t a Corona related question.  It’s an Xcode question.