What is the use of jcenter and Maven Central repositories ?
Answer
Overview
JCenter and Maven Central are remote Maven repositories — online servers that host Android/Java libraries (AARs and JARs) that Gradle downloads as dependencies.
Maven Central
The official, primary repository for Java/Android libraries maintained by Sonatype.
gradle// settings.gradle (or build.gradle — modern Flutter projects) repositories { mavenCentral() // ← Official Maven repository } // Example dependency hosted on Maven Central dependencies { implementation 'com.squareup.retrofit2:retrofit:2.9.0' implementation 'com.google.code.gson:gson:2.10.1' }
JCenter (Deprecated)
JCenter was Bintray's/JFrog's Maven repository — once the default for Android. JCenter is now deprecated (shut down in 2022).
gradle// ❌ Avoid — JCenter shut down repositories { jcenter() // Deprecated! } // ✅ Migrate to Maven Central instead repositories { mavenCentral() }
In Flutter's Android Project
Modern Flutter projects (and AGP 7+) use both Google and Maven Central:
gradle// android/settings.gradle (Flutter project) pluginManagement { repositories { google() // Android-specific packages (Google) mavenCentral() // General Java/Android libraries gradlePluginPortal() // Gradle plugins } } dependencyResolutionManagement { repositories { google() mavenCentral() } }
Comparison
| Feature | Maven Central | JCenter |
|---|---|---|
| Status | ✅ Active | ❌ Deprecated (2022) |
| Owner | Sonatype / Apache | JFrog (Bintray) |
| Default in Android | ✅ Now default | Was default (pre-2021) |
| Security | ✅ Strong review | Had fewer requirements |
| Google packages | ❌ Use text | — |
Other Common Repositories
gradlerepositories { google() // Google's Android libraries, Firebase mavenCentral() // General OSS maven { url 'https://jitpack.io } // GitHub-hosted libraries mavenLocal() // Local Maven cache (~/.m2) }
Where Dependencies Come From
textFlutter Plugin (pubspec.yaml): camera: ^0.10.0 ↓ pub.dev fetches the Dart package ↓ Dart package's android/ folder references: implementation 'androidx.camera:camera-core:1.3.0' (Maven Central / Google) ↓ Gradle downloads the AAR from the repository
Summary: Maven Central is the standard repository for Android dependencies. JCenter is dead — avoid it. Flutter projects typically use
+textgoogle()in their AndroidtextmavenCentral().textsettings.gradle