snaggs
snaggs

Reputation: 5713

Gradle compile dependencies with/out "@aar" what is the difference?

I have gradle dependencies configuration in my Android project:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])   
    compile 'com.appsflyer:af-android-sdk:4.8.0@aar'
    provided 'com.segment.analytics.android:analytics:4.+'
}

However I can write compile 'com.appsflyer:af-android-sdk:4.8.0@aar' line without @aar

compile 'com.appsflyer:af-android-sdk:4.8.0

From Appsflyer docs they tell to use @aar but since I'm new to gradle, is there any difference with/out @aar postfix? Because it looks like works in both cases

Upvotes: 2

Views: 459

Answers (2)

Gabriele Mariotti
Gabriele Mariotti

Reputation: 364858

Using the @aar notation means that you want to download only the aar artifact, and no dependencies.
You can check this part of documentation:
Check the Artifact only notation section:

An artifact only notation creates a module dependency which downloads only the artifact file with the specified extension. Existing module descriptors are ignored..

Using the @aar notation if you want to download the dependencies, you should add transitive=true.

Upvotes: 1

Fox
Fox

Reputation: 2561

AAR is an Android library file

See docs

The '@aar' indicates that gradle should download an AAR file as opposed to JAR file. In this case my guess would be that the provider of the library forwards requests to the AAR file whether the '@aar' is added or not.

Upvotes: 0

Related Questions