Leadbolt Unity Plugin Example gets JNI Exception

Hello, I’m rather new to Unity and I try to build a simple app to test most of Unity.

But since I also want to monetize my future stuff, I wanted to try out 3rd party plugins for monetization. Since I have used Leadbolt before, I hoped I could use it here on Unity again.

I downloaded everything from Leadbolt and tried to set it up, but I only got an NullPointerExeption.
I tried the example-app from Leadbolt itself and got the same error.

Since it is the example app who also throws the exeption I guess I did something wrong when I set up the environment.
I use the sdk Android 5.0(API 21) and JRE1.8._025.

This is the error message I get from Unity:

Exception: JNI: Init’d AndroidJavaClass with null ptr!
UnityEngine.AndroidJavaClass…ctor (IntPtr jclass) (at C:/BuildAgent/work/d63dfc6385190b60/Runtime/Export/AndroidJavaImpl.cs:539)
UnityEngine.AndroidJavaObject.get_JavaLangClass () (at C:/BuildAgent/work/d63dfc6385190b60/Runtime/Export/AndroidJavaImpl.cs:517)
UnityEngine.AndroidJavaObject.FindClass (System.String name) (at C:/BuildAgent/work/d63dfc6385190b60/Runtime/Export/AndroidJavaImpl.cs:508)
UnityEngine.AndroidJavaClass._AndroidJavaClass (System.String className) (at C:/BuildAgent/work/d63dfc6385190b60/Runtime/Export/AndroidJavaImpl.cs:528)
UnityEngine.AndroidJavaClass…ctor (System.String className) (at C:/BuildAgent/work/d63dfc6385190b60/artifacts/EditorGenerated/AndroidJava.cs:93)
AppTrackerAndroid.initializeAppTracker () (at Assets/AppTrackerAndroid.cs:17)
AppTrackerAndroid.startSession (System.String apikey) (at Assets/AppTrackerAndroid.cs:24)
Ad.Start () (at Assets/Ad.cs:15)

Somewhere in your code you are initializing the plugin like this:

AndroidJavaClass plugin = new AndroidJavaClass("fullname");

The name you pass to this constructor cannot be found, which can be caused by a few reasons:

  1. You misspelled the plugin’s class full name? (it should be the FULL NAME, e.g: package.class)
  2. You did not include the plugin’s library in your build. The plugin’s code should be included with your project so it can be accessed at runtime. Usually you would place your plugin’s JAR under Plugins/Android so it will be packaged with your game when you export it.