问题描述
我想给MoPub SDK添加到我的应用程序。我尝试导入和添加库在Android的工作室,但我看不到我的应用程序的任何广告。
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最初添加库,但我想机器人工作室,因为它是新的谷歌支持的工具了。
I used Eclipse to add the library originally, but I am trying Android Studio because it is the new Google-supported tool now.
我如何添加MoPub的SDK使用Android的工作室?
How do I add MoPub's SDK to my app using Android Studio?
推荐答案
也许Android的工作室已经更新了,我不能按照abaar或pyus13的回答解决这个问题。
Maybe Android studio has updated, I couldn't solve it according to abaar or pyus13's answer.
这答案是基于Android 0.6.1工作室
This answer is based on Android Studio 0.6.1.
-
解压缩
mopub-sdk.zip
你下载
打开项目结构(文件 - >项目结构)在Android的工作室
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的工作室导入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
,并添加一行包括':'
打开项目的 build.gradle
文件,在依赖项中添加编制项目('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
模块,点击它,然后选择依赖
的顶部标签,更改 com.android.support:support-v4:+
的距离编译范围
到提供
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.
这篇关于如何添加mopub广告与Android工作室库整合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!