Search code examples
androidparse-platformgradleandroid-gradle-pluginbuild.gradle

Provided Gradle Dependency Is AAR not JAR


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.

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

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

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'

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:

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.

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.

My Question

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


Solution

  • 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'