'How to add Repository maven in new Android Studio Project setup(2022)?
I want to use the maven library in the android studio project. in the library documentation, they mention adding like this,
repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
}
But in the new android studio build.gradle
file looks like this
plugins {
id 'com.android.application' version '7.1.0' apply false
id 'com.android.library' version '7.1.0' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
So, how do I want to add this library repository, Thank you
Solution 1:[1]
In the latest Android Studio Bumblebee(2021.1.1) version, if you see it in build.gradle(Project)
the new structure looks like this
build.gradle(Project)
plugins {
id 'com.android.application' version '7.1.0' apply false
id 'com.android.library' version '7.1.0' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
In order to use the other libraries like maven
, you have to go to the settings.gradle
and you have to the maven link like below
settings.gradle
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
maven { url 'https://jitpack.io' } // add like this
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' } // add like this
}
}
rootProject.name = "your project name here"
include ':app'
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Prasath |