简体   繁体   中英

Gradle 3 implementation for aar dependency

I have an Android project which has couple of libraries as aar dependency. The libraries and the application has the same flavors ( internal and external ). The libraries gets generated as LibraryName-internal-release.aar and LibraryName-internal-debug.aar , LibraryName-external-release.aar and LibraryName-external-debug.aar .

In the previous versions of gradle I add the aar file as dependency to the project as follows

internalDebugCompile(name: 'LibraryName-internal-debug', ext: 'aar')
internalReleaseCompile(name: 'LibraryName-internal-release', ext: 'aar')
externalDebugCompile(name: 'LibraryName-external-debug', ext: 'aar')
externalReleaseCompile(name: 'LibraryName-external-release', ext: 'aar')

How to use the latest implementation tag in dependency. I tried using implementation(':LibraryName@aar') in gradle 3.0 but it fails to find the correct matching dependency. How to use the implementation tag correclty in this situation ?

Use implementation instead of compile simply like this.

internalDebugImplementation(name: 'LibraryName-internal-debug', ext: 'aar')
internalReleaseImplementation(name: 'LibraryName-internal-release', ext: 'aar')
externalDebugImplementation(name: 'LibraryName-external-debug', ext: 'aar')
externalReleaseImplementation(name: 'LibraryName-external-release', ext: 'aar')

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