Include AAR dependency in Android Library Project

≯℡__Kan透↙ 提交于 2019-12-03 03:29:24

Already found the solution. It looks like the AAR dependencies are all moved together, so the main project tries to resolve AAR dependency in its 'libs' directory, where it obviously does not exist. What you need to do is define more accurately where each module that depends on the library with the AAR file can find it relative to its path, e.g.

dirs project(':my-library-project').file('libs')

I had it working like this:

compile 'com.example.lib:lib_name:1.0.0@aar'

In this example lib_name:1.0.0.aar is file name.

In case the answer by user1033552 doesn't work. In my case, it didn't work.

Below steps worked for me.

  1. Right click project -> New -> Module -> Import aar package -> select file and import it.
  2. In settings.gradle, Make dependent is after dependency.For example include ':imported-aar', ':your-library', ':app'
  3. Now build.gradle of your-library add compile project(':imported-aar')
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!