Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k views
in Technique[技术] by (71.8m points)

how to add mopub ads library integration with android studio

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...