Weizhi
Weizhi

Reputation: 1037

Gradle dependencies version suffix

In my gradle build script, i have the following

dependencies {
    compile 'foo.bar:beef:1.2.3@aar'
}
  1. What is the suffix aar for?
  2. What is the difference between using compile 'foo.bar:beef:1.2.3@aar' vs compile 'foo.bar:beef:1.2.3'

Upvotes: 1

Views: 838

Answers (2)

Arahan Jha
Arahan Jha

Reputation: 13

Please check the following link :

Why should I include a gradle dependency as `@aar`

Here you can note that in gradle, it is denoted as "aar", where as in other java development frameworks, it is denoted as ".jar". So this suffix "aar" is nothing but an archive.

The main difference between a Jar and a AAR is that AARs include resources such as layouts, drawables etc. This makes it a lot easier to create self-contained visual components. For example if you have multiple apps that use the same login screen, with Jars you could share classes but not the layout, styles, etc., you still had to duplicate them. With AARs everything is bundled in one neat package.

Upvotes: 0

Nick Rundle
Nick Rundle

Reputation: 639

From the documentation

The @ character separates the dependency’s coordinates from the artifact’s file extension.

So this:

dependencies {
    compile 'foo.bar:beef:1.2.3@aar'
}

is equivalent to this:

dependencies {
    compile(group: 'foo.bar', name: 'beef', version: '1.2.3', extension: 'aar')
}

The default extension is '.jar' if not specified.

Upvotes: 2

Related Questions