简体   繁体   中英

How to have compile only dependency on an AAR lib

I have an android SDK and I wanted to add new google auth feature to this SDK but keep the dependency compileOnly. This way the user of my SDK would not need to add the play services dependency if they don't want this feature. I tried using 'provided' keyword in gradle to have compile-only dependency on the other google auth feature lib, but it does not work for 'aar' libs.

The 'provided' keyword only works for 'jar' files as mentioned here

You can instruct users to exclude unneeded optional dependencies. They can declare dependency on your library like that:

compile('com.example:foo:1.0') {
    exclude group: 'com.google', module: 'bar'
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM