GameAnalytics and Enterprise integration issues

ANDROID:

  1. Added the build.settings plugin information (unneeded right?)

  2. Deleted my project’s bin & assets folders

  3. Copied the libplugin.gameanalytics.so file into my project’s libs folder

  4. Compiled

Calling the plugin in my code like so:

GA = require "plugin.gameanalytics" GA.init ( { game\_key = 'realdetails', secret\_key = 'realdetails', build\_name = "0.1", } )

Which executes and gives this error:

V/Corona ( 8370): \> Class.forName: plugin.gameanalytics.LuaLoader V/Corona ( 8370): WARNING: Could not load 'LuaLoader' W/System.err( 8370): java.lang.ClassNotFoundException: plugin.gameanalytics.LuaLoader W/System.err( 8370): at java.lang.Class.classForName(Native Method) W/System.err( 8370): at java.lang.Class.forName(Class.java:204) W/System.err( 8370): at java.lang.Class.forName(Class.java:169) W/System.err( 8370): at com.ansca.corona.NativeToJavaBridge.callLoadClass(NativeToJavaBridge.java:375) W/System.err( 8370): at com.naef.jnlua.LuaState.lua\_pcall(Native Method) W/System.err( 8370): at com.naef.jnlua.LuaState.call(Unknown Source) W/System.err( 8370): at com.ansca.corona.CoronaLua.dispatchEvent(CoronaLua.java:98) W/System.err( 8370): at network.NetworkRequest$LuaCallback$1.executeUsing(NetworkRequest.java:598) W/System.err( 8370): at com.ansca.corona.CoronaRuntimeTaskDispatcher$TaskEvent.Send(CoronaRuntimeTaskDispatcher.java:153) W/System.err( 8370): at com.ansca.corona.events.EventManager.sendEvents(EventManager.java:229) W/System.err( 8370): at com.ansca.corona.Controller.updateRuntimeState(Controller.java:222) W/System.err( 8370): at com.ansca.corona.graphics.opengl.CoronaGLSurfaceView$CoronaRenderer.onDrawFrame(CoronaGLSurfaceView.java:402) W/System.err( 8370): at com.ansca.corona.graphics.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1622) W/System.err( 8370): at com.ansca.corona.graphics.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1377) W/System.err( 8370): Caused by: java.lang.NoClassDefFoundError: plugin/gameanalytics/LuaLoader W/System.err( 8370): ... 14 more W/System.err( 8370): Caused by: java.lang.ClassNotFoundException: Didn't find class "plugin.gameanalytics.LuaLoader" on path: /data/app/xxxxx.apk W/System.err( 8370): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65) W/System.err( 8370): at java.lang.ClassLoader.loadClass(ClassLoader.java:501) W/System.err( 8370): at java.lang.ClassLoader.loadClass(ClassLoader.java:461) W/System.err( 8370): ... 14 more W/System.err( 8370): com.naef.jnlua.LuaRuntimeException: module 'plugin.gameanalytics' not found:resource (plugin.gameanalytics.lu) does not exist in archive W/System.err( 8370): no field package.preload['plugin.gameanalytics'] W/System.err( 8370): no file '(null)/plugin.gameanalytics.lua' W/System.err( 8370): no file '(null)/plugin.gameanalytics.lua' W/System.err( 8370): no file '/data/app-lib/xxxxxxx/libplugin.gameanalytics.so' W/System.err( 8370): no file './plugin.gameanalytics.so' W/System.err( 8370): no file '(null)/plugin.gameanalytics.so' W/System.err( 8370): no file '/data/app-lib/xxxxxxx/libplugin.so' W/System.err( 8370): no file './plugin.so' W/System.err( 8370): no file '(null)/plugin.so' W/System.err( 8370): at com.naef.jnlua.LuaState.lua\_pcall(Native Method) W/System.err( 8370): at com.naef.jnlua.LuaState.call(Unknown Source) W/System.err( 8370): at com.ansca.corona.CoronaLua.dispatchEvent(CoronaLua.java:98) W/System.err( 8370): at network.NetworkRequest$LuaCallback$1.executeUsing(NetworkRequest.java:598) W/System.err( 8370): at com.ansca.corona.CoronaRuntimeTaskDispatcher$TaskEvent.Send(CoronaRuntimeTaskDispatcher.java:153) W/System.err( 8370): at com.ansca.corona.events.EventManager.sendEvents(EventManager.java:229) W/System.err( 8370): at com.ansca.corona.Controller.updateRuntimeState(Controller.java:222) W/System.err( 8370): at com.ansca.corona.graphics.opengl.CoronaGLSurfaceView$CoronaRenderer.onDrawFrame(CoronaGLSurfaceView.java:402) W/System.err( 8370): at com.ansca.corona.graphics.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1622) W/System.err( 8370): at com.ansca.corona.graphics.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1377)

Has someone successfully added this feature? Can someone point me in the right direction if I am missing steps?

@javin

You’re almost there  ;).

You just need to create a subfolder named armeabi-v7a in your libs folder and move the .so file there.

All .so files should be put in the libs/armeabi-v7a folder.

jar files live in the libs folder.

You’re correct. build.settings isn’t necessary in Enterprise projects, I usually just have a basic build.settings that only includes which orientations the app supports (portrait/landscape, etc) so that I can do basic testing in the Corona Simulator without having to compile for device.

I’d recommend removing the plugin definition from build.settings to avoid potential confusion/conflicts.

Thanks, that worked.

Corona docs need to be updated to reflect this, they currently state:

http://docs.coronalabs.com/native/plugin/#enterprise

Enterprise

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

On iOS, plugins will be in the form of .a (static library) files that needs to be linked into your app executable.

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 ant script sees them.

When you add a plugin you should be aware of the following:

  • Resources.  If the plugin comes with resources, you should make sure those resources are available
  • Dependencies.  If the plugin depends on linking to system frameworks or libraries, you’ll need to make sure the appropriate linker flags are set.

Great to hear that it’s working  :D.

I’ve notified CoronaLabs about the docs…

@javin

You’re almost there  ;).

You just need to create a subfolder named armeabi-v7a in your libs folder and move the .so file there.

All .so files should be put in the libs/armeabi-v7a folder.

jar files live in the libs folder.

You’re correct. build.settings isn’t necessary in Enterprise projects, I usually just have a basic build.settings that only includes which orientations the app supports (portrait/landscape, etc) so that I can do basic testing in the Corona Simulator without having to compile for device.

I’d recommend removing the plugin definition from build.settings to avoid potential confusion/conflicts.

Thanks, that worked.

Corona docs need to be updated to reflect this, they currently state:

http://docs.coronalabs.com/native/plugin/#enterprise

Enterprise

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

On iOS, plugins will be in the form of .a (static library) files that needs to be linked into your app executable.

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 ant script sees them.

When you add a plugin you should be aware of the following:

  • Resources.  If the plugin comes with resources, you should make sure those resources are available
  • Dependencies.  If the plugin depends on linking to system frameworks or libraries, you’ll need to make sure the appropriate linker flags are set.

Great to hear that it’s working  :D.

I’ve notified CoronaLabs about the docs…