Issue
I am trying to add this ColorPicker to my Android project.
I imported this library into my Java class:
import petrov.kristiyan.colorpicker.ColorPicker;
When I add it to Gradle and sync, I don't get any error.
But when I build the project, I get this error:
Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not find petrov.kristiyan:colorpicker-library:1.1.10.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/petrov/kristiyan/colorpicker-library/1.1.10/colorpicker-library-1.1.10.pom
- https://repo.maven.apache.org/maven2/petrov/kristiyan/colorpicker-library/1.1.10/colorpicker-library-1.1.10.pom
Required by:
project :app
Gradle Project file:
plugins {
id 'com.android.application' version '7.3.1' apply false
id 'com.android.library' version '7.3.1' apply false
}
Gradle App file:
plugins {
id 'com.android.application'
}
android {
namespace 'com.example.appname'
compileSdk 33
defaultConfig {
applicationId "com.example.appname"
minSdk 21
targetSdk 33
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'petrov.kristiyan:colorpicker-library:1.1.10'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
I have Android Studio version 2021.3.1 Patch 1 installed.
I followed the steps mentioned in this post, but it didn't work.
I am facing the same issue with this ColorPicker too.
Does anyone have any other solution to this problem?
Solution
It looks like the library is old and wasn't migrated to the Maven Central repository, since JCenter was deprecated.
But you can use it from Jitpack repository:
- Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
- Add the dependency to your app build.gradle:
dependencies {
implementation 'com.github.kristiyanP:colorpicker:v1.1.10'
}
Enjoy!
Answered By - sergpetrov
Answer Checked By - Candace Johnson (JavaFixing Volunteer)