0

I made a library, but when I tried to use it with implementation 'com.example:mylibrary:1.3.0' in my app's build.gradle, I keep getting an error saying the ConstraintLayout dependency (which the library uses but not the app) is not found. However it was explicitly defined in the library's build.gradle with implementation.

When I ran gradlew app:dependencies on the terminal, it shows that the library has no dependencies, even though it actually has 2. This seems to be the source of the problem, Gradle can't detect the dependencies of the library.

I didn't run into this problem for a while but when I decided to remove the ConstraintLayout dependency from my app an error appears during build.

Nicolas
  • 5,182
  • 2
  • 22
  • 58

1 Answers1

1

When you're using implementation for the dependencies in your library, the project which is dependent with it will not see the dependencies. You need to use api instead of implementation.

ישו אוהב אותך
  • 22,515
  • 9
  • 59
  • 80
  • 1
    Thanks, I thought `implementation` and `compile` were the same. More info: https://stackoverflow.com/a/44419574/5288316 – Nicolas Sep 20 '18 at 12:10
  • Actually this wasn't the problem, it was with the pom file not including the library's dependencies. – Nicolas Sep 22 '18 at 02:18