Native plugin MacOS support

Hi Corona,

I have several questions about Native plugins on MacOS

  • When I build my Corona Application with the Corona Simulator, the My.dylib is not inserted in the My.app. I have to do it myself with the Finder. Is there a parameter in a config file somewhere that I missed ? I do not have this problem when I build an iOS app or Android App. Also, the My.dylib is correctly found by the Corona Simulator itself.

  • Is there somewhere a MacOS Corona Shell that I can use for using my plugin on MacOS without building it with the Corona Simulator ? In the native plugin template directories there is such app for iOS and Android but not for MacOS. Of course I can create myself a MacOS application linked with all the Corona Engine, but I think this is not good. The Corona Simulator can correctly create a MacOS application, so I guess that it is probably possible to do it directly with XCode without having myself to link my app with all the Corona dependencies.

  • In the Github directory there is a …/platform/mac/CoronaShell. To build it I had to modify the CoronaShell.xcodeproj because there is nowhere a CoronaCards Framework. But the MacOS application does not run, after I linked it with …/platform/mac/CoronaCards. Is this “CoronaShell” obsolete ?

  • I did not found the implementation source of the CoronaDelegate.h interface anywhere.

  • Is there a way to have the MacOS application resizable ?

Thank you if Corona can help me.

/Larpoux

[Edit] : I was able to generate the CoronaShell with corona/subrepos/enterpise/build.sh. This is really fine. But I loose too much time with stupid problems. I am lucky not having a boss behind me shouting about delays :wink:

Another question, tied this one with Android.

When I run my native app on a real device (with Android studio) everything works fine.

When I run the same App, with the same configuration (Android Studio) on an Android Simulator I get the following error :

E/AndroidRuntime: FATAL EXCEPTION: main

    Process: xyz.canardoux.mi_corazon, PID: 28324

    java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file “/system/framework/org.apache.http.legacy.boot.jar”, zip file “/data/app/xyz.canardoux.mi_corazon-ZN28i6StTGJvSh6yXrSuMQ==/base.apk”

This happens when I execute :

System.loadLibrary("lua");

in 

package com.ansca.corona;

JavaToNativeShim.class

The major difference between an Android simulator and a real device is that the Simulator execute x86 instead of Arm.

Is it possible that the lua DLL is not x86 ? And if this is the case, how to fix that ?

Note :

my build.gradle scripts, both for the app and the plugin contains the following :

android { compileSdkVersion 27 defaultConfig { minSdkVersion 15 targetSdkVersion 27 versionCode 1 versionName "1.0" } splits { abi { enable true reset() include 'x86', 'armeabi-v7a' universalApk true } } }

If you want to use gradle for Android builds, check out gradle branch on Github. It’s quite awesome. I’m actively working on it, it is our next build system. At this point it completely integrates build.settings into build process, and supports most of plugins, but that part is still under heavy dev.

About CoronaShell, yes, you can of course build it. It is a target in platform/mac/ratatouille.xcodeproj as a subproject. build Simularot (rttplayer) first, then CoronaShell will run OK.

And, it should run with plugins, I think they have to be in the bundle.app/Contents/Plugins/ 

Anyway: built macOS apps are CoornaShell with bundled in resources, inco and plugins.

To make easier with corona shell I pushed target to the gradle branch on github.

Thank you @Vlads :-)  :slight_smile:

I switched to the Gradle branch. I tested a build with the Corona Simulator (who is called now ‘Rtt Player’ !) and I  still have  problem, running my App on the Android Simulator :

ERROR: Failure [INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries, res=-113] Error found during installation!

On a real device this is a little bit better : my device complains that it does not find my plugin.

Try to follow instructions in readme at link I gave you. You should be able to run in Android Simulator without problems.

Hi Vlads.

I tried to follow the instructions in the readme, but unsuccessfully : the Android Simulator starts correctly Corona, but complains after that my Native Plugin was not found.

But I am happy now : I put the missing JNI libraries inside my official Corona/Native lib directory, and now I can run my App both on a real device and on the Android simulator  :slight_smile:

I suggest that Coronalabs provide those missing libraries in the Corona Download-bundle.

I think you’ve mostly settled on this, but be aware.  Corona is unlikely to bundle libs and sources they don’t control in the bundle.  You’ll always need to download external dependencies yourself.

Tip: Since you figured this out, I suggest you give back to the community. 

  • Go to the documentation page where you ‘followed the steps’.
  • Scroll to the bottom.
  • Click the blue ‘Report an Issue’ button.
  • Leave a nice and clear message explaining:
    • what you did
    • what you saw 
    • what you expected to see
    • how you fixed the problem

Include pertinent links so the person up handles docs updates can incorporate not only your learnings, but the source links too.

Sure. I will do better. Sorry for my bad post.

I think there is no problem to provide those missing libraries for x386 (and some others). Those libraries are already provided for Armeabi and only for Armeabi.

Hi @vlads. Today is a better day for me  :) . Sorry for yesterday.

I would like to beta-test seriously your gradle branch.

Could you tell us rapidly what is needed for our native plugins running ?

I will have my test result back to you when finished.

Another question, tied this one with Android.

When I run my native app on a real device (with Android studio) everything works fine.

When I run the same App, with the same configuration (Android Studio) on an Android Simulator I get the following error :

E/AndroidRuntime: FATAL EXCEPTION: main

    Process: xyz.canardoux.mi_corazon, PID: 28324

    java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file “/system/framework/org.apache.http.legacy.boot.jar”, zip file “/data/app/xyz.canardoux.mi_corazon-ZN28i6StTGJvSh6yXrSuMQ==/base.apk”

This happens when I execute :

System.loadLibrary("lua");

in 

package com.ansca.corona;

JavaToNativeShim.class

The major difference between an Android simulator and a real device is that the Simulator execute x86 instead of Arm.

Is it possible that the lua DLL is not x86 ? And if this is the case, how to fix that ?

Note :

my build.gradle scripts, both for the app and the plugin contains the following :

android { compileSdkVersion 27 defaultConfig { minSdkVersion 15 targetSdkVersion 27 versionCode 1 versionName "1.0" } splits { abi { enable true reset() include 'x86', 'armeabi-v7a' universalApk true } } }

If you want to use gradle for Android builds, check out gradle branch on Github. It’s quite awesome. I’m actively working on it, it is our next build system. At this point it completely integrates build.settings into build process, and supports most of plugins, but that part is still under heavy dev.

About CoronaShell, yes, you can of course build it. It is a target in platform/mac/ratatouille.xcodeproj as a subproject. build Simularot (rttplayer) first, then CoronaShell will run OK.

And, it should run with plugins, I think they have to be in the bundle.app/Contents/Plugins/ 

Anyway: built macOS apps are CoornaShell with bundled in resources, inco and plugins.

To make easier with corona shell I pushed target to the gradle branch on github.

Thank you @Vlads :-)  :slight_smile:

I switched to the Gradle branch. I tested a build with the Corona Simulator (who is called now ‘Rtt Player’ !) and I  still have  problem, running my App on the Android Simulator :

ERROR: Failure [INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries, res=-113] Error found during installation!

On a real device this is a little bit better : my device complains that it does not find my plugin.

Try to follow instructions in readme at link I gave you. You should be able to run in Android Simulator without problems.

Hi Vlads.

I tried to follow the instructions in the readme, but unsuccessfully : the Android Simulator starts correctly Corona, but complains after that my Native Plugin was not found.

But I am happy now : I put the missing JNI libraries inside my official Corona/Native lib directory, and now I can run my App both on a real device and on the Android simulator  :slight_smile:

I suggest that Coronalabs provide those missing libraries in the Corona Download-bundle.

I think you’ve mostly settled on this, but be aware.  Corona is unlikely to bundle libs and sources they don’t control in the bundle.  You’ll always need to download external dependencies yourself.

Tip: Since you figured this out, I suggest you give back to the community. 

  • Go to the documentation page where you ‘followed the steps’.
  • Scroll to the bottom.
  • Click the blue ‘Report an Issue’ button.
  • Leave a nice and clear message explaining:
    • what you did
    • what you saw 
    • what you expected to see
    • how you fixed the problem

Include pertinent links so the person up handles docs updates can incorporate not only your learnings, but the source links too.

Sure. I will do better. Sorry for my bad post.

I think there is no problem to provide those missing libraries for x386 (and some others). Those libraries are already provided for Armeabi and only for Armeabi.

Hi @vlads. Today is a better day for me  :) . Sorry for yesterday.

I would like to beta-test seriously your gradle branch.

Could you tell us rapidly what is needed for our native plugins running ?

I will have my test result back to you when finished.