com.ansca.corona.CoronaEnvironment cannot be resolved to a type

Hi,

I’m following the Android QuickStart guide (http://coronalabs.com/blog/2014/04/01/tutorial-corona-enterprise-quickstart-android/) - after deploying the example app to my device, it immediately crashes and I see the following error stack:

E/AndroidRuntime(16020): FATAL EXCEPTION: main

E/AndroidRuntime(16020): java.lang.Error: Unresolved compilation problem: 

E/AndroidRuntime(16020): com.ansca.corona.CoronaEnvironment cannot be resolved to a type

E/AndroidRuntime(16020): 

E/AndroidRuntime(16020): at com.wyre.wyre.CoronaApplication.onCreate(CoronaApplication.java:22)

E/AndroidRuntime(16020): at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1024)

E/AndroidRuntime(16020): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4684)

E/AndroidRuntime(16020): at android.app.ActivityThread.access$1400(ActivityThread.java:159)

E/AndroidRuntime(16020): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1376)

E/AndroidRuntime(16020): at android.os.Handler.dispatchMessage(Handler.java:99)

E/AndroidRuntime(16020): at android.os.Looper.loop(Looper.java:176)

E/AndroidRuntime(16020): at android.app.ActivityThread.main(ActivityThread.java:5419)

E/AndroidRuntime(16020): at java.lang.reflect.Method.invokeNative(Native Method)

E/AndroidRuntime(16020): at java.lang.reflect.Method.invoke(Method.java:525)

E/AndroidRuntime(16020): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)

E/AndroidRuntime(16020): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)

Any idea what I could be doing wrong?

Thanks!

Ed - couple of questions that may help someone on our side troubleshoot:

  1. Does the Lua code you are running in this app work otherwise (e.g., in the simulator)?

  2. What type of native code are you including in this app?

I’m not sure what could be wrong. I followed the instructions just to see for myself and everything compiled and installed on the device without any issues. The compiled app works as expected.

After looking at your error I see it’s referring to onCreate, which tells me that you might have the onLoaded code in the wrong place?

Please check that the onLoaded code you wrote is located inside the CoronaRuntimeEventHandler class (and replaces the existing one).

One of engineers got back with me and suggested that you’re missing a library that provides that class or there is a typo some where.  You should compiling one of the sample apps like ExtendingUI.   Once that’s working you can compare the configurations and see what’s different.

Also are you sure CoronaEnterprise is installed in your Applications folder?  Or possibly your project.properties does not have a reference to Corona’s Android library project.

Rob

Thanks for the replies - this has been solved now. Turns out all I had to do was delete my ‘bin’ folder before rerunning the build.sh script! (I must’ve made a build before changing any of the sample code, which persisted some stuff in that folder still). Thanks again. 

Ed - couple of questions that may help someone on our side troubleshoot:

  1. Does the Lua code you are running in this app work otherwise (e.g., in the simulator)?

  2. What type of native code are you including in this app?

I’m not sure what could be wrong. I followed the instructions just to see for myself and everything compiled and installed on the device without any issues. The compiled app works as expected.

After looking at your error I see it’s referring to onCreate, which tells me that you might have the onLoaded code in the wrong place?

Please check that the onLoaded code you wrote is located inside the CoronaRuntimeEventHandler class (and replaces the existing one).

One of engineers got back with me and suggested that you’re missing a library that provides that class or there is a typo some where.  You should compiling one of the sample apps like ExtendingUI.   Once that’s working you can compare the configurations and see what’s different.

Also are you sure CoronaEnterprise is installed in your Applications folder?  Or possibly your project.properties does not have a reference to Corona’s Android library project.

Rob

Thanks for the replies - this has been solved now. Turns out all I had to do was delete my ‘bin’ folder before rerunning the build.sh script! (I must’ve made a build before changing any of the sample code, which persisted some stuff in that folder still). Thanks again.