Search code examples
androideclipsecordovamopub

Integrating MoPub SDK with Android Eclipse


I am having trouble integrating MoPub SDK. I am following the documentation on twitter to download the android SDK, then editing the build path on my project's folder to incorporate it but I keep getting several build errors. I have android-support-v4.jar in a different folder but I've tried adding it as an external .jar but I get 2000+ errors. Even including the .jar's that are needed for the SDK (mopub volley support annotations, etc) doesn't help the build path.

enter image description here

Can anyone with experience help me with this issue?


Solution

  • I had a problem adding third party libraries or even support libraries to Eclipse projects.

    These libraries may come with resources or just .jar file.

    How to add with resources libraries:

    1. Create new Android Project From Existing Code
    2. From project Properties > Android at the bottom check the Is Library CheckBox.
    3. To add this library to your project > go to Project Properties > Android at the bottom Add to add library then choose the wanted library.

    How to add *.jar libraries:

    1. Create if not existed in your Project folder libs folder.
    2. copy *.jar to libs folder
    3. From Project Properties > Java Build Bath > Add JARs > choose the *.jar from your libs folder.

    EDIT: I get to your question while trying to add MoPub library to my project and I got same errors.

    Then after searching little deep .. I fix it and it is error free now.Here is the solution that works for me:

    1. download these files required by MoPub: mopub-volley-1.1.0.jar and Millennial Media SDK 6.1.zip

    2. Extract Millennial Media SDK 6.1.zip inside extracted folder you will find two folders open the one with the same name Millennial Media SDK 6.1... you will find two folders again open that one mm-ad-sdk-android-6.1.0-5323db4 you will find a folder and two zip files extract that one mm-ad-sdk-android-ant-6.1.0-5323db4.zip with ant in the name.

    3. Create a project from the extracted folder as I referred before in How to add with resources libraries you get MMActivity project.

    4. From file tab > Import > Existing projects into workspace then choose mopub-android-full-sdk.zip you will get a project with some errors.

    5. Copy android-support-annotations.jar, android-support-v4.jar and mopub-volley-1.1.0.jar to libs folder of mopub-sdk project.

    6. Create a project from android-support-v7-recyclerview as referred before in How to add with resources libraries you will get recyclerview project.

    7. From Project Properties > Android > Add .. add the MMActivity and recyclerview as That works for me. I hope this is helpful for you.