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
3
Answers
In the latest Android Studio Bumblebee(2021.1.1) version, if you see it in
build.gradle(Project)
the new structure looks like thisIn order to use the other libraries like
maven
, you have to go to thesettings.gradle
and you have to the maven link like belowI recently had a lot of confusion with this, but I was able to solve it this way, I just added Maven in Settings.graddle, when I added twice this caused me conflicts, but when I tried just adding once then it worked correctly.
I am using Android Studio Dolphin 2021.3.1.
Referring to answer from Prasath, I would simplify the answer.
In old gradle structure you have a line in Project build.gradle:
In new gradle structure you have to add a line in setting.gradle like this:
You do not have to add the line in pluginManagement{} section in settings.gradle.