.jar files don't get added from the libs directory (Android)

Hello,

So for some reason I started encountering this problem where the .jar files don’t get added to the final ape. More specifically, the classes are not seen in the application.

After I build the App, I go into bin/classes and there is no plugin folder there. I tried compiling the “IncludeAllFeatures” project, but have the same problem.

Ultimately this gives me an error when I try to require(“plugin”) because it does not see the LuaLoader class.

What might be the problem behind this?

PS: I used to compile without any problems where all the classes and files got added, but today when I started working on it something changed. I also tried past projects that used to work, and they are also down.

Hi,

I also have this problem, and now i’m waiting for answer from Corona Team by email, i will share solution as soon as i have it.

btw. With researching this problem, found that my plugin.library.jar is included in apk, it was in the ‘assets’ directory instead of ‘lib’. Android by default loads libraries from ‘lib’ folder, and maybe Corona SDK doesn’t trying to load jars manually. It can be a bug, or feature (we should specify somewhere which jars to load).

Ok, I’m glad I’m not the only one. Maybe they changed the compilation or something but the weird thing is that I didn’t update anything, so I don’t know what’s happening.

I guess we’ll just have to wait for corona’s reply

Putting the .jar files in the libs directory is correct.  Nothing has changed on Corona’s side that would cause it to not work.  The bin/ classes/ directory shouldn’t have the library’s .class files in there.  The only reason I can think of that would cause a .jar file to end up in your assets directory is if you put the .jar in the Corona project folder and thus its being copied in.

Okay,

  1. Developing my plugin based on the ‘App’ template

  2. Testing with build.sh script

  3. Building release of the plugin with build.plugin.sh

  4. And now how to use plugin.library.jar (for an example) locally in my Corona Project, without submitting it to corona plugins cloud? Where to put them instead of put the .jar under ‘libs’ dir in the Corona project folder

Here is my build: https://dl.dropboxusercontent.com/u/49855874/Corona.apk

In the documentation:

Url: http://docs.coronalabs.com/native/plugin/
Section:  Using Plugins

 

Enterprise

Native plugins can easily be added to your iOS or Android project.

On Android, plugins can come in the form of .so (shared library) or .jar files. These files should be in your projects libs directory to ensure that the antscript sees them.

When you’re building the plugin the .jar files that you put in the libs directory aren’t merged into plugin.jar.  Those have to be added to your Android project separately.

Ohhhhhh my bad. The error was higher up in the log cat that I did not see. It turned out that the class had an error in it, so it was not a valid class.

On a different note, you can’t put .jar files into the libs directory at all in plugin projects because the build.plugin.xml file clears the libs directory every build. That can be fixed with a small change to the code.

Hi,

I also have this problem, and now i’m waiting for answer from Corona Team by email, i will share solution as soon as i have it.

btw. With researching this problem, found that my plugin.library.jar is included in apk, it was in the ‘assets’ directory instead of ‘lib’. Android by default loads libraries from ‘lib’ folder, and maybe Corona SDK doesn’t trying to load jars manually. It can be a bug, or feature (we should specify somewhere which jars to load).

Ok, I’m glad I’m not the only one. Maybe they changed the compilation or something but the weird thing is that I didn’t update anything, so I don’t know what’s happening.

I guess we’ll just have to wait for corona’s reply

Putting the .jar files in the libs directory is correct.  Nothing has changed on Corona’s side that would cause it to not work.  The bin/ classes/ directory shouldn’t have the library’s .class files in there.  The only reason I can think of that would cause a .jar file to end up in your assets directory is if you put the .jar in the Corona project folder and thus its being copied in.

Okay,

  1. Developing my plugin based on the ‘App’ template

  2. Testing with build.sh script

  3. Building release of the plugin with build.plugin.sh

  4. And now how to use plugin.library.jar (for an example) locally in my Corona Project, without submitting it to corona plugins cloud? Where to put them instead of put the .jar under ‘libs’ dir in the Corona project folder

Here is my build: https://dl.dropboxusercontent.com/u/49855874/Corona.apk

In the documentation:

Url: http://docs.coronalabs.com/native/plugin/
Section:  Using Plugins

 

Enterprise

Native plugins can easily be added to your iOS or Android project.

On Android, plugins can come in the form of .so (shared library) or .jar files. These files should be in your projects libs directory to ensure that the antscript sees them.

When you’re building the plugin the .jar files that you put in the libs directory aren’t merged into plugin.jar.  Those have to be added to your Android project separately.

Ohhhhhh my bad. The error was higher up in the log cat that I did not see. It turned out that the class had an error in it, so it was not a valid class.

On a different note, you can’t put .jar files into the libs directory at all in plugin projects because the build.plugin.xml file clears the libs directory every build. That can be fixed with a small change to the code.