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?
CodePudding user response:
I tried pulling the library and had same results as yours. Looking at these 3 search results from the maven repository
Looks like the repository hasn't been updated for years, have you considered looking for another color-picker library?, I'd recommend this one that I use.
Not sure though if the developers have an xml version of this, as this is targeted to Compose
usage, but you can integrate composables
to xml, and this picker returns an object that holds 4 properties of a Color, hue
, saturation
, alpha
and value
that you can use.
CodePudding user response:
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'
}