- Home /
AndroidJavaException - java.lang.ClassNotFoundException
I'm trying to integrate mopub ads in my game on android. I've followed the instructions on the github page but no luck. specifically, I have:
imported the mopub-sdk project in eclipse.
Built and exported the mopub-sdk.jar to my newly-created android project (in the ./bin folder), project named "MoPubUnityPlugin"
Added class.jar and android-support-v4.jar to the ./libs folder of the MoPubUnityPlugin (from github)
Added MoPubUnityPlugin.java (from github) to the ./src/main/java/ folder and configured build path to ./src/main/java/
built the project and took the MoPubUnityPlugin.jar to Unity3D's ./Plugins/Android folder
imported the MoPubAndroid.unitypackage (from github) in the project
called MoPubAndroid.requestInterstitalAd("blablathekeyhere"); which calls
new AndroidJavaClass( "com.mopub.mobileads.MoPubUnityPlugin" );
logcat reports the following:
AndroidJavaException:java.lang.ClassNotFoundException: com.mopub.mobileads.MoPubUnityPlugin
If it matters, I'm also using google play services plugin for unity and prime31 In-App Purchasing plugin, both work fine. but mopub is killing me :|
Answer by Yury-Habets · Feb 23, 2015 at 05:12 PM
Try using a utility (for example JDGui http://jd.benow.ca/) that shows contents of the jar file you put into the Unity project. Make sure the class is really present there, it may have been stripped by proguard. If it is present and you put the correct jar into Plugins/Android or Plugins/Android/libs and you are still missing the classes - something should be very wrong here. (I assume this is all Unity 4.6)
Your answer
Follow this Question
Related Questions
NotFoundException: File res/mipmap-xhdpi-v4/ic_launcher.png from xml type layout resource 0 Answers
How do I use the Android Library in Unity? 0 Answers
What I have to do to add com.unity3d to my Android game? 0 Answers
Get Phone number of android mobile device - Android native code to Unity c# 3 Answers