如何整合MoPub在Android中Studio中的共享库中 [英] How to integrate MoPub inside a shared library in Android Studio

查看:1487
本文介绍了如何整合MoPub在Android中Studio中的共享库中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要MoPub集成了3个不同的游戏共享一个Android库中。

我试图用织物的插件,但没有成功......一些尝试后,我得到这个错误:

 错误:无法解析:com.mopub.volley:mopub凌空:1.1.0

然后我也试图按照本指南,你可以在这里找到( https://github.com/mopub/mopub-android-sdk/wiki/Getting-Started ),但我总是得到一些错误(我无法通过终端执行命令的gradle或我得到相同的错误上面提到的)。

有人能帮助我吗?
谢谢

米尔科

更新

由于@Edward我能够在我的项目导入正确mopub-SDK。

为了修复mopub凌空抽射错误,先清洁液,读哪些文件在控制台丢失,看路,重新指定路径,添加mopub凌空-1.1.0.jar,mopub-凌空-1.1.0.pom的文件夹中。
重建,你准备去!


  

在我的情况下,mopub-SDK正在寻找一个内部的mopub凌空LIB
  不存在的文件夹在Android SDK相同的路径。


如果你得到相关millenial SDK的另一个错误,在mopub-SDK库里面的build.gradle文件的相关部分加入这一行:

 编译文件树(导演:'库',包括:['的* .jar'])

你应该得到的东西是这样的:

  {相关性
  编译文件树(导演:'库',包括:['的* .jar'])
  编译com.android.support:support-v4:22.0.0
  编译com.android.support:support-annotations:22.0.0
  编译com.mopub.volley:mopub凌空:1.1.0
}

希望这可以帮助你!


解决方案

  1. 去下载MoPub SDK。

  2. 解压,你会得到一个mopub-SDK文件夹

  3. 导航到您的项目的位置,进入项目文件夹,将解压缩mopub-SDK拖放到文件夹中。

  4. 导航回至Android Studio并打开项目的settings.gradle文件,包括MoPub SDK作为一个模块,如下图所示。您可能需要Android Studio中再次同步摇篮有mopub-SDK'在左边的项目窗口显示出来。

    包括':应用',':mopub-SDK


  5. 打开项目的build.gradle文件,并添加jcenter作为存储库和MoPub SDK作为一个依赖:

    {库
        jcenter()
    }

    ...

    依赖性{
        编制项目(':mopub-SDK)
    ...
    }


I need to integrate MoPub inside an android library shared by 3 different games.

I tried to use the fabric plugin with no success... after some attempts I get this error:

Error:Failed to resolve: com.mopub.volley:mopub-volley:1.1.0

Then I also tried to follow this guide that you can find here (https://github.com/mopub/mopub-android-sdk/wiki/Getting-Started) but I always get some errors (I can't execute the gradle command via terminal or I get the same error as mentioned above).

Can someone help me? Thank you,

Mirko

UPDATE

Thanks to @Edward I was able to import correctly mopub-sdk in my project.

In order to fix the mopub-volley error, first clean the solution, read which files are missing in the console, look at the path, recreate the indicated path and add mopub-volley-1.1.0.jar, mopub-volley-1.1.0.pom in that folder. Rebuild and you are ready to go!

In my case, mopub-sdk was looking for the mopub-volley lib inside an inexistent folder in the same path of the android sdk.

If you get another error related to the millenial sdk, add this line in the dependencies section of the build.gradle file inside the mopub-sdk library:

compile fileTree(dir: 'libs', include: ['*.jar'])

you should get something like this:

dependencies {
  compile fileTree(dir: 'libs', include: ['*.jar'])
  compile 'com.android.support:support-v4:22.0.0'
  compile 'com.android.support:support-annotations:22.0.0'
  compile 'com.mopub.volley:mopub-volley:1.1.0'
}

Hope this can help you!

解决方案

  1. Go download the MoPub SDK.
  2. Unzip and you will get a mopub-sdk folder
  3. Navigate to your ‘Project location’, go into your project folder, and drop the unzipped mopub-sdk into the folder.
  4. Navigate back to Android Studio and open your project's settings.gradle file and include the MoPub SDK as a module as shown below. You may need to sync Gradle again in Android Studio to have the ‘mopub-sdk’ show up in the left Project window.

    include ':app', ':mopub-sdk'

  5. Open your project's build.gradle file and add jcenter as a repository and the MoPub SDK as a dependency:

    repositories { jcenter() }

    ...

    dependencies { compile project(':mopub-sdk') ... }

这篇关于如何整合MoPub在Android中Studio中的共享库中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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