What is the correct way to build MoPub jar plugin for Unity?

I tried using the unity package for MoPub and followed the instructions there together with some info on this Unity Answers thread. However, I’m having two problems here:

  1. How to build a jar file that automatically outputs the name mopub-sdk.jar. What I’m using is the export to “java/jar” approach. Is this okay?
  2. I can’t compile the jar because it’s returning an error connected to NativeAds Utils. Error message is written below:

JAR creation failed. See details for
additional information. Class files on
classpath not found or not accessible
for:
‘mopub-sdk/src/main/java/com/mopub/common/util/Drawables.java’
Class files on classpath not found or
not accessible for:
‘mopub-sdk/src/main/java/com/mopub/common/util/VersionCode.java’
Class files on classpath not found or
not accessible for:
‘mopub-sdk/src/main/java/com/mopub/mobileads/MoPubErrorCode.java’
Class files on classpath not found or
not accessible for:
‘mopub-sdk/src/main/java/com/mopub/mobileads/util/ResponseHeader.java’
Class files on classpath not found or
not accessible for:
‘mopub-sdk/src/main/java/com/mopub/nativeads/NativeErrorCode.java’
Exported with compile errors:
mopub-sdk/src/main/java/com/mopub/nativeads/util/Utils.java

Any ideas on how to resolve this? I tried using the created jar file even with these errors just to test if this will work, but no luck and the logs return:

05-06 17:09:51.965: I/Unity(25098): AndroidJavaException: java.lang.NoSuchMethodError: no static method with name='instance' signature='()Ljava/lang/Object;' in class Lcom/mopub/mobileads/MoPubUnityPlugin;

Thanks in advance.

Hi, you must use the newest version of the android-support-v4.jar because UnityPlugin and MoPubSdk have different jars. Or beter yet, use the newest one you can find on your own Android SDK in sdk/extras/support.