Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Susanne_Mueller · Dec 10, 2014 at 02:16 AM · androidjava

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)

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by liortal · Dec 10, 2014 at 07:01 AM

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.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Susanne_Mueller · Dec 12, 2014 at 01:25 PM 0
Share

Yes, it is this: AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer");

I included every jar and cs-file like described in the readme, I also changed the manifest.xml, like it said und put it in Plugins/Android.

In another forum I found the hint, that it only throws an error because it's not on an android device, but when I try to run it on my device the app simply crashes.

avatar image liortal · Dec 12, 2014 at 04:11 PM 0
Share

This call will not work unless you're on Android (this call reaches out to the Java V$$anonymous$$ and locates a loaded class with that name. In the editor or other platforms this will fail). Try to run it on an Android device and get the logs they will show what's going on (use logcat).

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Accessing Data from a Android java class 1 Answer

Issue installing apk using old Cert 1 Answer

Error Building Android Project 2 Answers

Unity 5 seems to can't find my Android Plugin 0 Answers

Accessing variables from android java objects 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges