This application failed to load and execute main.lua
Sep 11 2018 11:59 PM
I'm having similar problem with my android app too. Once I open the app, i display the Corona splashscreen and it crash immediately.
Is there any update on this issue?
I'm doing a corona native build
I can make a new thread for this issue with more detail as to my steps if you'd like, but I'm encountering this same issue while transitioning an old Corona Enterprise project to Corona Native.
Per troubleshooting steps from this thread, I was able to get the template project running once, but subsequent builds always yield the "failed to load and execute main.lua" error. A clean prior to running again fixes the issue for that build, but incremental builds do not work.
I'm on MacOS Mojave 10.14.1 and have tried with the latest public release and daily builds. Figuring out this issue with the template project will hopefully help with the issue I'm facing in transitioning my project.
I found this excerpt from the docs, which appears to be the issue I'm facing based on the following build output from gradle. The weird thing is that I still receive the same build error when doing a clean build, yet it does not fail to load main.lua. Is there something wrong with my Corona account or the installation of Corona? Each time I switched from the public release to the daily build, I ran "Setup Corona Native.app" and verified that the symbolic link is in the reported location.
Insights about this issue would be greatly appreciated, as I thought that the template project would work without issue and help me root out of the cause for it to occur in my project, but I'm left a bit more confused now.
The certifyBuild task digitally signs libcorona.so (inside app/src/main/jniLibs) with a fingerprint generated from the resources.car file. Without this task, the Corona application will fail to start on the device and yield a message about not being able to find/load main.lua.
== certifyBuild == warning: CoronaBuilder: Splash Screen Control plugin not found for user 'myEmailAddress' - if you want to customize the splash screen you can get it here: https://marketplace.coronalabs.com/plugin/splash-screen-control app_sign: failed to replace signature *** (ReplaceSignature) 7480960d9e44885319a1aa686c2491b0 /Volumes/Data/git/TestApp/android/app/src/main/assets/resource.car Replacing signature... done. 7480960d9e44885319a1aa686c2491b0 /Volumes/Data/git/TestApp/android/app/src/main/assets/resource.car
@vlads, Thanks for the suggestion!
I do have instant run disabled, and as I stated, a clean build does yield a runnable build for the template project, however my issue is that all subsequent incremental builds fail to run on the device with the aforementioned error. I should be able to do an incremental build without issue, right? I do not have luck with clean builds from my old Corona Enterprise project, however, and I believe that to possibly be related to why the incrementals are not working with the template project.
The old enterprise project includes libcorona.so during the ndkBuild per the Android.mk file to use some headers it provides for use in C++ code. Because of this, the libcorona.so file gets copied to the build intermediates and gets signed there, prior to being packaged up within the apk. There are no issues in this process using Corona Enterprise build 2016.2942. While this may not be a direct translation to what occurs during an incremental build of the template project, I believe resolving that issue (and the resultant improved understanding of the libcorona.so signing process) would aid in resolving the issue with transitioning the old enterprise project.
Is there a way to get incrementals to work with the template project, or do you have any clues about what may be going wrong with the enterprise project I'm moving to native?
Alright, so I managed to shuffle my build process around a bit to make it work correctly. I already had some of these steps correct, but here's what I did for anyone else who may find themselves in a similar boat:
- Made sure that libcorona.so was being deleted from both jniLibs and "$projectDir/build/intermediates/jniLibs/" + getCurrentFlavor() + "/armeabi-v7a/libcorona.so" (we only build for armeabi-v7a currently, so if you build other ABIs, make sure you remove those too)
- I'm not sure why the build process wasn't automatically picking up the new libcorona.so in jniLibs, and thus not copying it back into the build intermediates after signing. It could be because I'm on an older gradle and ndk version. I'll update this post for others who may encounter the issue if I later find that this isn't necessary after updating to the latest for both.
- Removed libcorona.so inclusion from Android.mk
- It appears that while this project previously used headers from libcorona.so in c++, it no longer does, so the Android.mk inclusion was unnecessary.
- Ran the certifyBuild task prior to the ndkBuild running, so that it pulls in the signed jniLibs/libcorona.so
After that, I had to add the _corona_splash_screen.png from the template project to /res/drawable, per the docs on the splash screen with native builds until I purchase the splash screen plugin to remove it. I also had to update my call to the open function for sqlite3 as the library now has a new way of passing in open flags from the old version we were working with.
With all of those completed, I've been able to do both clean and incremental builds and run my original project without issue so far.
I'm now running with Corona Native instead of Enterprise!