# Android Maven Central ###### tags: `Android Gradle` # Where are libraries downloaded from? Android Studio downloads them from Maven repository server defined in build.gradle. Apache Maven is a tool developed by Apache that provides a file server for contributing libraries. In general, there are only two standard Android library file servers: **jcenter** and **Maven Central**. **build.gradle (:project):** ```java= //Better have mavenCentral as the first one due to jcenter shut down repositories { mavenCentral() google() jcenter() } ``` >**Note:** >JCenter will no longer have new packages/ updates from March, 2021 and existing ones can still be downloaded until **February 1st, 2022**. After it, it will stop fetching and compiling.[color=red] >>![](https://i.imgur.com/CBXaQhe.png) [color=pink] # Maven Central It is a Maven repository managed by sonatype.org, even though it is a maven repository like jcenter but their servers and mantainers are different. Use Maven Warehouse for libraries in warehouse: **build.gradle (:project):** ```java= repositories { mavenCentral() } ``` If the author of the library has its own server, then you will have to define the url of that warehouse in repositories. ```java= repositories { maven { url 'https://maven.aliyun.com/repository/google' } } ``` # Dependencies ## Dependency Format No matter which dependency, its format will be the same: > **GROUP_ID** : **ARTIFACT_ID** : **VERSION** [color=orange] **Example:** **GROUP_ID:** com.squareup.okhttp3 **ARTIFACT_ID:** okhttp **VERSION:** 4.7.2 ```java= implementation 'com.squareup.okhttp3:okhttp:4.7.2' ``` ## Action after dependency is called When dependency is called, it will go to **maven warehouse server to download jar or aar file**. ### Difference between jar and aar The aar file was developed on top of the jar file. aar in simple words, was made to put specific Android files, such as AndroidManifest.xml, resource files, Assets, etc. So there will be a jar inside the aar file, under the name of classes.jar # Reference https://www.itread01.com/content/1541840286.html