Building .jar plugin

Hi,

I have a problem with building .jar file for my plugin via corona native.

In manual it says that plugin will build automatically when project is build, build.gradle indicated the same but I don’t get jar file but instead I get plugin\build\outputs\aar\plugin-release.aar. 

There is no directory for jar.

How to build plugin in jar version so I can submit it to marketplace?

Anyone?

Let me see if I can get an engineer to respond to this.

Rob

Hi!

According to my experience to build jar you need to run “Clean” then the sequence of gradle tasks: build -> exportPluginJar, then the result jar file will be placed to ‘/plugin/build/outputs/jar/<plugin_name>.jar’. Also there is another way to get your jar: you can find classes.jar in ‘/plugin/build/intermediates/bundles/release/’ and then rename it to proper plugin name (that is what ‘exportPluginJar’ task does).

Kirill

I am having the same issue. No Jar is built and there is no bundles/release folder.

On plugin build.gradle (Corona 2018.3233) it is trying to get the classes.jar from “$buildDir/intermediates/bundles/default/”. but that  “default” folder also does not exist.

Can someone confirm that Jar plugin building is really working?

Ok. I think I found the issue.

The classes.jar is being saved at “android/plugin/build/ intermediates/intermediate-jars/release” (or “android/plugin/build/intermediates/intermediate-jars/debug”), and the gradle script, as I mentioned earlier, is trying to get the classes.jar “…/ intermediates/bundles/default/”, so it is not finding it and therefore we don’t see it on the “build/outputs/jar/”.

Thought I’d bump this topic up.  Has this bug been logged? While not a huge deal, it’d be nice for the default project to work as expected out of the box.

Let me see if I can get an update.

Rob

Anyone?

Let me see if I can get an engineer to respond to this.

Rob

Hi!

According to my experience to build jar you need to run “Clean” then the sequence of gradle tasks: build -> exportPluginJar, then the result jar file will be placed to ‘/plugin/build/outputs/jar/<plugin_name>.jar’. Also there is another way to get your jar: you can find classes.jar in ‘/plugin/build/intermediates/bundles/release/’ and then rename it to proper plugin name (that is what ‘exportPluginJar’ task does).

Kirill

I am having the same issue. No Jar is built and there is no bundles/release folder.

On plugin build.gradle (Corona 2018.3233) it is trying to get the classes.jar from “$buildDir/intermediates/bundles/default/”. but that  “default” folder also does not exist.

Can someone confirm that Jar plugin building is really working?

Ok. I think I found the issue.

The classes.jar is being saved at “android/plugin/build/ intermediates/intermediate-jars/release” (or “android/plugin/build/intermediates/intermediate-jars/debug”), and the gradle script, as I mentioned earlier, is trying to get the classes.jar “…/ intermediates/bundles/default/”, so it is not finding it and therefore we don’t see it on the “build/outputs/jar/”.

Any news on this?

Is using the classes.jar file from “android/plugin/build/intermediates/intermediate-jars/release” the correct way?

Best regards!

This should definitely be read from intermediate-jars folder. Seems to me that Corona people simply didn’t notice that underlying Android build folder paths changed and have left old folder structure inside of the default build.gradle project inside of the App template. Would be good if you can update this since it’s simply wrong.

yes, you’re correct. We should edit the contents of the template project/build script

If you plan to double check things in project templates, you might as well take a look at default App.xcodeproj  because App target from template project is also not buildable due to the fact that by default you are setting path in there to be:

path = "~/Library/Application Support/Corona/Native";

instead of:

path = "$HOME/Library/Application Support/Corona/Native";

[member=‘uerceg’], this is fixed a while ago, but we can’t really update existing projects you have.

Same goes for Android Studio template. While next daily build would have a fixed version of the template, you’ll have to apply fix to your projects yourself. Luckily it is quite a small change to android/plugin/build.gradle, replacing part of file with this lines.

@vlads Yeah, fixes are not big, I have performed them on existing projects, but reason I wrote this was because this is what I noticed literally 2 days ago when I downloaded latest Corona build (2018.3326) and from there I checked Corona/Native/Project Template/App/ios/App.xcodeconfig  content. In there path is set with ~ and not $HOME. I was not checking nightly builds, rather just official version.

You can download daily builds from https://developer.coronalabs.com/downloads/coronasdk/ (press download button in header of https://coronalabs.com/))

There was about 130 builds since 2018.3326, our last public release, and template was updated around 3378 (latest daily build is 2019.3459).