I'm building an Android app in Kotlin. I want it to have graphs and I'm using
implementation(libs.androidplot.core)
in my build.gradle file. But I get the following error when reloading the Gradle project:
Failed to resolve: com.halfhp.fig:figlib:1.0.7
Show in Project Structure dialog
Affected Modules: app
The advice on the internet is roughly this: What is the correct way of changing jcenter to mavenCentral? To change jcenter() to mavenCentral(). However, my build.gradle looks the following and I don't know how to change to source of dependencies correctly - there is no "buildscripts" section:
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
}
android {
namespace = "com.example.myapp"
compileSdk = 34
defaultConfig {
applicationId = "com.example.myapp"
minSdk = 32
targetSdk = 34
versionCode = 1
versionName = "1.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = "11"
}
buildFeatures {
viewBinding = true
}
}
dependencies {
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.appcompat)
implementation(libs.material)
implementation(libs.androidx.constraintlayout)
implementation(libs.androidx.lifecycle.livedata.ktx)
implementation(libs.androidx.lifecycle.viewmodel.ktx)
implementation(libs.androidx.navigation.fragment.ktx)
implementation(libs.androidx.navigation.ui.ktx)
implementation(libs.androidx.legacy.support.v4)
implementation(libs.androidx.fragment.ktx)
implementation(libs.androidx.activity)
implementation(libs.androidplot.core)
implementation ("com.halfhp.fig:figlib:1.0.7")
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
}
However, my build.gradle looks the following and I don't know how to change to source of dependencies correctly - there is no "buildscripts" section:
You probably already have mavenCentral()
configured. On newer projects, the default is to configure this in settings.gradle
or settings.gradle.kts
in a dependencyResolutionManagement()
lambda:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
}
Your problem is your version. Replace:
implementation ("com.halfhp.fig:figlib:1.0.7")
with:
implementation ("com.halfhp.fig:figlib:1.0.11")
1.0.11
is the only version reported to be in Maven Central.
Also, please note that this project has not been updated in 3 years.