如何添加与 android studio 集成的 mopub 广告库 [英] how to add mopub ads library integration with android studio

查看:28
本文介绍了如何添加与 android studio 集成的 mopub 广告库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将 MoPub SDK 添加到我的应用程序中.我尝试在 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.

我最初使用 Eclipse 添加库,但我正在尝试使用 Android Studio,因为它现在是 Google 支持的新工具.

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

如何使用 Android Studio 将 MoPub 的 SDK 添加到我的应用中?

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

推荐答案

可能是Android studio更新了,根据abaar或pyus13的回答我没能解决.

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

此答案基于 Android Studio 0.6.1.

This answer is based on Android Studio 0.6.1.

  1. 解压你下载的mopub-sdk.zip

在 Android Studio 中打开项目结构(文件 -> 项目结构)

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

点击左上角的+"按钮添加一个新模块

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

您可以看到新建模块向导,选择导入现有项目并点击下一步

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

选择刚刚解压的mopub-sdk文件夹

Choose the mopub-sdk folder you just unzipped

点击下一步并完成.现在您可以看到 Android Studio 将 mopub-sdk 导入到您的项目中.并且 settings.gradle 文件已添加到您的项目中

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

打开settings.gradle,添加一行include ':'

打开你项目的build.gradle文件,在依赖项中,添加compile project('mopubsdk')(mopubsdk就是你的项目名刚刚添加)

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

再次打开项目结构,可以看到左侧的mopubsdk模块,点击它,然后选择顶部的Dependencies标签,更改com.android.support:support-v4:+ 的范围从 CompileProvided

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.

这篇关于如何添加与 android studio 集成的 mopub 广告库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆