提供的 Gradle 依赖是 AAR 而不是 JAR [英] Provided Gradle Dependency Is AAR not JAR

查看:70
本文介绍了提供的 Gradle 依赖是 AAR 而不是 JAR的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题,我试图在我的项目中包含一个名为 ParseLoginUI 的库.

I have an issue where I'm trying to include a library in my project called the ParseLoginUI.

问题是它使用提供的标签而不是编译.我相信提供的标签意味着项目需要提供这个依赖项才能让库工作,而不是这个库自己编译库.

The issue is it uses the provided tag instead of compile. I believe the provided tag means that the project needs to supply this dependency in order for the library to work rather than this library compiling the libraries itself.

所以在我的 Android 库中,它像这样引用了 Facebook SDK.

So in my Android library it references the Facebook SDK like so.

 provided 'com.facebook.android:facebook-android-sdk:4.0.1'

然后在我的主要模块 mobile/build.gradle 中,我像这样编译 Facebook sdk.

Then in my mobile/build.gradle which is my main module I compile the Facebook sdks like so.

compile 'com.facebook.android:facebook-android-sdk:4.0.1'

我一直在遵循安装此库的指南,这就是您的意图.这是我收到的警告,它阻止我编译 ParseLoginUI/build.gradle 文件(提供它的文件).

I have been following the guide for installing this library and this is how you're meant to do it. Here is the warning I get that stops me from compiling thrown by the ParseLoginUI/build.gradle file (the one providing it).

Warning:Project ParseLoginUI: provided dependencies can only be jars. com.facebook.android:facebook-android-sdk:aar:4.0.1 is an Android Library.

这个库的文档有一个修复:

The documentation for this library has a fix which is:

如果你使用的是 gradle 1.1.0 或更高版本,你可能会遇到警告:项目 ParseLoginUI:提供的依赖项只能是 jars.com.facebook.android:facebook-android-sdk:aar:4.0.1 是安卓系统Library".这是android gradle构建工具的一个未解决的问题.目前解决方法是使用 gradle 1.0.0.

If you are using gradle 1.1.0 or above, you may encounter "Warning:Project ParseLoginUI: provided dependencies can only be jars. com.facebook.android:facebook-android-sdk:aar:4.0.1 is an Android Library". It is an open issue of android gradle build tool. Currently the workround is using gradle 1.0.0.

很公平,但我不想为了解决这个问题而降级我的 gradle(目前正在运行 v1.2.3).必须有办法解决这个问题或更好的方法.

Fair enough but I don't want to downgrade my gradle (currently running v1.2.3) just to solve this issue. There must be a way round this or a better way of doing it.

我的问题

如何在库模块和主模块中都包含 Facebook SDK?

How can I include the Facebook SDK in both the library module and my main module?

推荐答案

您已经提到这是 Gradle 中的一个未解决的问题.如果您使用 ParseLoginUI 作为库模块.只需更改 ParseLoginUI 本身中的 build.gradle 文件即可.

you have already mentioned that it is an open issue in Gradle. If you are using ParseLoginUI as library module. Just change the build.gradle file in ParseLoginUI itself.

    provided 'com.facebook.android:facebook-android-sdk:4.0.1'
                              to
    compile 'com.facebook.android:facebook-android-sdk:4.0.1'

这篇关于提供的 Gradle 依赖是 AAR 而不是 JAR的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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