Skip to content Skip to sidebar Skip to footer

Unable To Use The Dependencies In The Arr File After Importing In The Application

I am trying to create a library, that uses recyclerview, and then importing that library ie., arr file to an application project. Changes i did in the library's gradle file are ap

Solution 1:

It seems like your your app-build does not know your library needs com.android.support:appcompat-v7:24.2.0 so it's not packaged into your apk.

You have two options:

  1. If you want to stay with including your library as simple aar file: Redeclare all dependencies of your library in your app
  2. Include your library in another way, so gradle can know the transitive dependencies:
    • Gradle Module Dependency
    • Maven Dependency
    • Ivy Dependency

Solution 2:

If you're publishing your library to an artifactory repository, you need to configure your publish gradle commands to add the dependencies your library has. In Bintray I do it in this way

artifacts {
    archives generateSourcesJar
}

task generateSourcesJar(type: Jar) {
    from android.sourceSets.main.java.srcDirs
    classifier 'sources'
}

Then you only need to tell gradle that you're using the classes that your library contains. You can do it in this way

compile('com.yourpage:yourlibrary:1.0.0'){
    transitive=true
}

Post a Comment for "Unable To Use The Dependencies In The Arr File After Importing In The Application"