Problem with running NATIVE plugin applovin

Hello, Please help me to get the point with native plugins.

I began with this doc as a start
https://coronalabs.com/blog/2017/10/19/using-plugins-with-native-android-builds/

I put everything that script has downloaded into folder Plugins, so it looks like this

PROJECTNAME\Plugins\android\plugin.applovin_com.coronalabs*.jar files

But i get 

01-01 21:58:11.950 13715 13737 V Corona  : > Class.forName: plugin.applovin.LuaLoader

01-01 21:58:11.951 13715 13737 I Corona  : WARNING: Could not load class ‘plugin.applovin.LuaLoader’

01-01 21:58:11.951 13715 13737 W System.err: java.lang.ClassNotFoundException: plugin.applovin.LuaLoader

01-01 21:58:11.952 13715 13737 W System.err: at java.lang.Class.classForName(Native Method)

01-01 21:58:11.952 13715 13737 W System.err: at java.lang.Class.forName(Class.java:453)

01-01 21:58:11.952 13715 13737 W System.err: at java.lang.Class.forName(Class.java:378)

01-01 21:58:11.952 13715 13737 W System.err: at com.ansca.corona.NativeToJavaBridge.callLoadClass(NativeToJavaBridge.java:317)

01-01 21:58:11.952 13715 13737 W System.err: at com.ansca.corona.JavaToNativeShim.nativeResize(Native Method)

01-01 21:58:11.952 13715 13737 W System.err: at com.ansca.corona.JavaToNativeShim.resize(JavaToNativeShim.java:394)

01-01 21:58:11.952 13715 13737 W System.err: at com.ansca.corona.graphics.opengl.CoronaGLSurfaceView$CoronaRenderer.onSurfaceChanged(CoronaGLSurfaceView.java:382)

01-01 21:58:11.952 13715 13737 W System.err: at com.ansca.corona.graphics.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1612)

01-01 21:58:11.952 13715 13737 W System.err: at com.ansca.corona.graphics.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1378)

01-01 21:58:11.953 13715 13737 W System.err: Caused by: java.lang.ClassNotFoundException: Didn’t find class “plugin.applovin.LuaLoader” on path: DexPathList[[zip file “/data/app/com.mycompany.app-x6Nn9fEN5OggNzV7y8x8fw==/base.apk”],nativeLibraryDirectories=[/data/app/com.mycompany.app-x6Nn9fEN5OggNzV7y8x8fw==/lib/arm, /data/app/com.mycompany.app-x6Nn9fEN5OggNzV7y8x8fw==/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib, /product/lib]]

01-01 21:58:11.953 13715 13737 W System.err: at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:93)

01-01 21:58:11.953 13715 13737 W System.err: at java.lang.ClassLoader.loadClass(ClassLoader.java:379)

01-01 21:58:11.953 13715 13737 W System.err: at java.lang.ClassLoader.loadClass(ClassLoader.java:312)

01-01 21:58:11.953 13715 13737 W System.err: … 9 more

01-01 21:58:11.953 13715 13737 I Corona  : ERROR: Runtime error

01-01 21:58:11.953 13715 13737 I Corona  : /Users/jenkins/slaveroot/workspace/Enterprise/OS/ios-11.4/release/release/platform/resources/init.lua:913: module ‘plugin.applovin’ not found:resource (plugin.applovin.lu) does not exist in archive

01-01 21:58:11.953 13715 13737 I Corona  : no field package.preload[‘plugin.applovin’]

01-01 21:58:11.953 13715 13737 I Corona  : no file ‘(null)/plugin/applovin.lua’

01-01 21:58:11.953 13715 13737 I Corona  : no file ‘(null)/plugin/applovin.lua’

01-01 21:58:11.953 13715 13737 I Corona  : no file ‘/data/app/com.mycompany.app-x6Nn9fEN5OggNzV7y8x8fw==/lib/arm/libplugin/applovin.so’

01-01 21:58:11.953 13715 13737 I Corona  : no file ‘./plugin/applovin.so’

01-01 21:58:11.953 13715 13737 I Corona  : no file ‘(null)/plugin/applovin.so’

01-01 21:58:11.953 13715 13737 I Corona  : no file ‘/data/app/com.mycompany.app-x6Nn9fEN5OggNzV7y8x8fw==/lib/arm/libplugin.so’

01-01 21:58:11.953 13715 13737 I Corona  : no file ‘./plugin.so’

01-01 21:58:11.953 13715 13737 I Corona  : no file ‘(null)/plugin.so’

01-01 21:58:11.953 13715 13737 I Corona  : no file ‘/data/app/com.mycompany.app-x6Nn9fEN5OggNzV7y8x8fw==/lib/arm/libplugin.applovin.so’

in adb log :frowning:

The file 

\plugin\applovin\LuaLoader.class 

is inside of jar

PROJECTNAME\Plugins\android\plugin.applovin_com.coronalabs\plugin.applovin.jar

What is wrong with it? In pure Corona everything works fine.

In build.settings i have

plugins =

{

        [“plugin.applovin”] =

        {

        publisherId = “com.coronalabs”

        },

},

If you’re doing native builds, you have to put the plugins in specific directories in your project. This doc says where to put things:

http://docs.coronalabs.com/native/android/index.html#project-templates

Rob

I tried to put in

android\app\libs\plugin.applovin.jar 

android\app\libs\plugin.applovin_com.coronalabs\plugin.applovin.jar 

android\app\libs\android\plugin.applovin_com.coronalabs\plugin.applovin.jar 

Corona\plugin\plugin.applovin.jar 

Corona\plugin\plugin.applovin_com.coronalabs 

with no use.

The documentation has only 2 strings about plugins. Why is this so? The similar problem was with pure lua plugin, no documentation 

And lua plugin just must be puted in PROJECT/Corona/plugin/GDBCLanguageCabinen.lua
and that’s all. And no WORD about it in documetation.
 

android — Contains all of the Android-specific code, projects, etc.

  • app
    • build.gradle — This is the main build script and it’s also where you set up some application settings like version and what SDK versions to use.
    • libs/ — This is where third-party (Corona) .jar plugins that your app relies upon should go.

 

In this code

https://github.com/agramonte/smaato-corona-plugin

plugins are just in folder NativePlugins maybe it is not working neither, i did not test it yet.

The plugins folder is if you’re using Corona Native to build a plugin. If you’re just using a plugin, you put the downloaded .jar files in:

App/android/libs/

Rob

Yes, i did all that. But it does not work for plugin.applovin.jar and i do not know where to start look for the fix. 

By the way Error message 

01-02 19:34:08.154 13548 13574 W System.err: Caused by: java.lang.ClassNotFoundException: Didn’t find class “plugin.applovin.LuaLoader” on path: DexPathList[[zip file “/data/app/com.mycompany.app-e459KQvM58GnzBKsfpEhjA==/base.apk”],nativeLibraryDirectories=[/data/app/com.mycompany.app-e459KQvM58GnzBKsfpEhjA==/lib/arm, /data/app/com.mycompany.app-e459KQvM58GnzBKsfpEhjA==/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib, /product/lib]]

It’s path name “com.mycompany.app” is just a common name? Caouse my project has different name.

java.lang.ClassNotFoundException: Didn’t find class “plugin.applovin.LuaLoader” means that plugin.applovin.jar 

 is not getting linked to your project.

First, verify you have a correct jar. Open it with achieve browser like 7z/unzip it and make sure there is file in it “plugin/applovin/LuaLoader.class”.

Second, you can explicitly add the jar to your project with gradle. In app’s build.gradle in dependencies you can add a dependecy to single file, like     api files(‘libs/plugin.applovin.jar’)

Finally, you can open your built APK with android studio and browse built classes, and see if plugin.applovin.LuaLoader is there.

Thank you so much!!! 

I managed to run simple project with applovin plugin

I just putted all the jars 

in

android\app\libs\applovin-sdk-8.1.4.jar 

android\app\libs\plugin.applovin.jar 

Checked in android studio. (Can’t add image here, but in packages view it shows plugin-plugin.library-Libraries) Cleaned all the project, It just loves to build old files.

Also checked that In Project structure (when you select app) in dependencies there is string {include=*.jar, dir=libs} 
(Previous time when it shoed me on path: DexPathList[[zip file "/data/app/com.mycompany.app-

it was old code. My application name is different and actual app name is showen in log adb)

And i got it working.

Will try to make it more comples, step by step. The facebook plugin has dozens jar files i will try to use folder for that but not sure, maybe it should be fileTree(include: [’*.jar’], dir: ‘libs’) for that case. But anyway it is a progress )

Thank you again!

Managed to add facebook plugin also. But i had to mannually add every jar file and also add 

<meta-data android:name=“com.facebook.sdk.ApplicationId” android:value="@string/facebook_app_id"/>

AndroidManifest.xml 

And 

<string name=“facebook_app_id”>xxxxxxx</string>

to res\values\strings.xml 

In build.settings i have

plugins =

{

        [“plugin.applovin”] =

        {

        publisherId = “com.coronalabs”

        },

},

If you’re doing native builds, you have to put the plugins in specific directories in your project. This doc says where to put things:

http://docs.coronalabs.com/native/android/index.html#project-templates

Rob

I tried to put in

android\app\libs\plugin.applovin.jar 

android\app\libs\plugin.applovin_com.coronalabs\plugin.applovin.jar 

android\app\libs\android\plugin.applovin_com.coronalabs\plugin.applovin.jar 

Corona\plugin\plugin.applovin.jar 

Corona\plugin\plugin.applovin_com.coronalabs 

with no use.

The documentation has only 2 strings about plugins. Why is this so? The similar problem was with pure lua plugin, no documentation 

And lua plugin just must be puted in PROJECT/Corona/plugin/GDBCLanguageCabinen.lua
and that’s all. And no WORD about it in documetation.
 

android — Contains all of the Android-specific code, projects, etc.

  • app
    • build.gradle — This is the main build script and it’s also where you set up some application settings like version and what SDK versions to use.
    • libs/ — This is where third-party (Corona) .jar plugins that your app relies upon should go.

 

In this code

https://github.com/agramonte/smaato-corona-plugin

plugins are just in folder NativePlugins maybe it is not working neither, i did not test it yet.

The plugins folder is if you’re using Corona Native to build a plugin. If you’re just using a plugin, you put the downloaded .jar files in:

App/android/libs/

Rob

Yes, i did all that. But it does not work for plugin.applovin.jar and i do not know where to start look for the fix. 

By the way Error message 

01-02 19:34:08.154 13548 13574 W System.err: Caused by: java.lang.ClassNotFoundException: Didn’t find class “plugin.applovin.LuaLoader” on path: DexPathList[[zip file “/data/app/com.mycompany.app-e459KQvM58GnzBKsfpEhjA==/base.apk”],nativeLibraryDirectories=[/data/app/com.mycompany.app-e459KQvM58GnzBKsfpEhjA==/lib/arm, /data/app/com.mycompany.app-e459KQvM58GnzBKsfpEhjA==/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib, /product/lib]]

It’s path name “com.mycompany.app” is just a common name? Caouse my project has different name.

java.lang.ClassNotFoundException: Didn’t find class “plugin.applovin.LuaLoader” means that plugin.applovin.jar 

 is not getting linked to your project.

First, verify you have a correct jar. Open it with achieve browser like 7z/unzip it and make sure there is file in it “plugin/applovin/LuaLoader.class”.

Second, you can explicitly add the jar to your project with gradle. In app’s build.gradle in dependencies you can add a dependecy to single file, like     api files(‘libs/plugin.applovin.jar’)

Finally, you can open your built APK with android studio and browse built classes, and see if plugin.applovin.LuaLoader is there.

Thank you so much!!! 

I managed to run simple project with applovin plugin

I just putted all the jars 

in

android\app\libs\applovin-sdk-8.1.4.jar 

android\app\libs\plugin.applovin.jar 

Checked in android studio. (Can’t add image here, but in packages view it shows plugin-plugin.library-Libraries) Cleaned all the project, It just loves to build old files.

Also checked that In Project structure (when you select app) in dependencies there is string {include=*.jar, dir=libs} 
(Previous time when it shoed me on path: DexPathList[[zip file "/data/app/com.mycompany.app-

it was old code. My application name is different and actual app name is showen in log adb)

And i got it working.

Will try to make it more comples, step by step. The facebook plugin has dozens jar files i will try to use folder for that but not sure, maybe it should be fileTree(include: [’*.jar’], dir: ‘libs’) for that case. But anyway it is a progress )

Thank you again!

Managed to add facebook plugin also. But i had to mannually add every jar file and also add 

<meta-data android:name=“com.facebook.sdk.ApplicationId” android:value="@string/facebook_app_id"/>

AndroidManifest.xml 

And 

<string name=“facebook_app_id”>xxxxxxx</string>

to res\values\strings.xml