Hoping for a really simple tutorial on creating native plugins...

Hmm…

I’m obviously happy to submit to the marketplace once the plugin is complete, but if that’s the only way to execute then how do we test during the build?

Right now, my plugin doesn’t do anything even remotely useful. It essentially just responds with a “hello world” string when a method is called. Definitely not useful for the marketplace, and until I see it working, I don’t even know that I’ve built it properly!

Figured I’m supposed to use the Corona folder within the template for testing. Android Studio’s emulator doesn’t work on this laptop (It’s an AMD…) so I’d planned to just use Corona Simulator and the jar plugin for that… Probably a stupid idea =).

I’ve USB’d to an Android phone and modified the main.lua within this Corona folder to load my plugin instead of plugin.library (because I’ve already renamed it), and the build process seems to work, an APK is installed to my device which is presumably this Corona app, and the app tries to launch. It then just instantly closes though (I’ve made no other changes to the main.lua, and I’m seeing this in the logcat:

27134-27154/com.mycompany.app A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x8 in tid 27154 (GLThread 943)

First off - is the com.mycompany.app just what the test process calls it, or am I supposed to change that somewhere?

Secondly - would a segfault like this indicate I’ve broken something in the Java (understandable that this isn’t the right place for support with that side of things), or have I just stumbled down the wrong path again?

Semi-answered my own question. If I replace the entire contents of main.lua with a simple print(“test”) and don’t load the Java plugin in at all, I still get a segfault:

2018-11-16 16:21:45.222 1324-1402/com.mycompany.app I/Corona: This application failed to load and execute main.lua

2018-11-16 16:21:45.224 1324-1402/com.mycompany.app A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x8 in tid 1402 (GLThread 1054)

I guess this isn’t the right way to test then?

Ohhh… If I do a “clean” before running every time I make a change to main.lua, the segfault doesn’t happen. Getting somewhere!

Now seeing a “Incorrect splash screen” error though, and the app still closes immediately once this error is closed, BUT I’m also seeing the test message from my Java method! YES!

Any advice on the splash error please? I think if I can resolve this, I’ll be good to go…

Try using latest version of Corona, and copy new template app. Since you don’t have much changes it would be easiest way to go.

Then transfer your changes to plugin/src …

Gahh, I didn’t get chance to give that a try this evening. Will report back in the morning, thanks!

I’ve installed the latest daily build, 2018.3437 (I was already on a daily build that was newer than the general release), copied over the template from this, and migrated my changes across. Still seeing “Incorrect splash screen - the splash screen built into the app is not the one that shipped with build 2018.3437 of Corona.” and the app then still closes itself…

This is confusing. Do you get splash screen error when just running a template app without any modifications?

Trying now. I’ll document as I go…

  • Copied the App folder to a new location. Didn’t even rename it this time.

  • “Open existing Android Studio project” within Android Studio. Selected the android folder.

  • Pops up with a notice to update the Gradle plugin to version 3.2.1 and Gradle 4.6. Clicked “Update”.

  • Sync autoruns and completes with warnings that “The specified Android SDK Build Tools version (27.0.3) is ignored, as it is below the minimum supported version (28.0.3) for Android Gradle Plugin 3.2.1. Android SDK Build Tools 28.0.3 will be used.”. Clicked to update and sync.

  • Sync re-runs and completes.

  • Plug my phone in, a Samsung S8 running Android 8 (API 26), hit “run” and chose the S8.

  • Build completes. APK installs. Phone launches. The Dictionary.com page opens in the background so the show() method is being invoked properly, but the splash error pops up on screen and when I click OK, the app closes.

Hmm… having written all of that down I wonder if it’s because the phone is API 26 and the SDK is 28. I’ve also just noticed that the app\build.gradle has a targetSDKVersion of 27 which probably isn’t right… does this not want to be as low as possible? If 27 is the lowest we can get away with (for JNLua maybe?) then am I going to have problems with testing on an Android 8 device? I do have an Android 9 here too, but it’s not currently in developer mode is all.

Nope. Tried now with various SDK versions to no avail. Also tried with a new clone of the template, this time choosing not to update Gradle versions, and the same error occurs.

There’s obviously something bad going on :frowning: let me investigate.

Thanks. I did a spot of Googling and found some old threads in these forums from people migrating out of Enterprise and getting the same error, if that helps. Seems some people worked around it by deleting the splash image but that didn’t seem to work for me either.

You’re on Mac, right? If so, make sure to run Setup Corona Native from Native folder

No, Windows. I haven’t run any setup though… Did I skip a major step? :grin:

No, you’re good. But Windows explains differences between my and your experience.

Also seeing “warning: CoronaBuilder: Splash Screen Control plugin not found” during the build phase, which I’ve been disregarding since I’m not trying to replace the splash… is it that Corona Native requires purchasing this plugin? We’ll actually be doing so anyway towards the end of building this particular project, as it’s for a client, but since it’s an annual fee we wanted to hold out until we’re ready for release!

It seems that splash screen is broken on windows.

Bummer, but at least I’m not doing something wrong!

I’ve put together a tutorial that concatenates everything I’ve read / figured out to get to this stage, as it didn’t seem like anything existed as a single, concise piece. Since everything seems to work and I now know that the splash error is a bug with the current builds, I’ll tidy this up and post a link here tomorrow. Hope it’s useful to others, and thanks for your help in getting there.

Any idea when the splash will be fixed please?

Here’s the tutorial! https://www.qweb.co.uk/blog/creating-a-corona-native-plugin-with-android-studio

Good job! Well look at splash screen issue Monday.