how to add mopub ads library integration with android studio

user2776223 picture user2776223 · Jan 28, 2014 · Viewed 9.3k times · Source

I am trying to add the MoPub SDK to my application. I try to import and add the library in Android Studio, but I do not see any ad in my app.

I used Eclipse to add the library originally, but I am trying Android Studio because it is the new Google-supported tool now.

How do I add MoPub's SDK to my app using Android Studio?

Answer

Wesley picture Wesley · Jun 25, 2014

Maybe Android studio has updated, I couldn't solve it according to abaar or pyus13's answer.

This answer is based on Android Studio 0.6.1.

  1. Unzip the mopub-sdk.zip that you downloaded

  2. Open project structure(File -> Project Structure) in Android Studio

  3. Click the '+' button on the upper left to add a new module

  4. You can see the New Module wizzard, choose Import Existing Project and click next

  5. Choose the mopub-sdk folder you just unzipped

  6. Click next and finish. Now you can see that Android Studio import the mopub-sdk into your project. And a settings.gradle file has been added into your project

  7. Open settings.gradle, and add a line include ':'

  8. Open the build.gradle file of your project, in the dependencies entry, add compile project('mopubsdk') (mopubsdk is the project name you just added)

  9. Open project structure again, you can see the mopubsdk module on the left, click on it, then choose Dependencies tab on the top, change com.android.support:support-v4:+'s scope from Compile to Provided

Now it's done. It works for me.