我正在嘗試將此ColorPicker添加到我的 Android 專案中。
我將此庫匯入到我的 Java 類中:
import petrov.kristiyan.colorpicker.ColorPicker;
當我將它添加到 Gradle 并同步時,我沒有收到任何錯誤。
但是當我構建專案時,我得到了這個錯誤:
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 專案檔案:
plugins {
id 'com.android.application' version '7.3.1' apply false
id 'com.android.library' version '7.3.1' apply false
}
Gradle 應用程式檔案:
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'
}
我安裝了 Android Studio 版本 2021.3.1 補丁 1。
我按照這篇文章中提到的步驟進行操作,但沒有奏效。
我也面臨與此ColorPicker相同的問題。
有沒有人有其他解決這個問題的方法?
uj5u.com熱心網友回復:
我試著拉圖書館,結果和你的一樣。查看來自 maven 存盤庫的這 3 個搜索結果
搜索結果 1
搜索結果 2
搜索結果 3
看起來存盤庫已經多年沒有更新了,您是否考慮過尋找另一個顏色選擇器庫?我會推薦我使用的這個。
去爸爸顏色選擇器
不確定開發人員是否有此的 xml 版本,因為這是針對Compose使用的,但您可以集成到 xml,并且composables此選擇器回傳一個包含顏色、、、和您可以使用的 4 個屬性hue的saturation物件。alphavalue
uj5u.com熱心網友回復:
看起來這個庫很舊,并且沒有遷移到 Maven 中央存盤庫,因為 JCenter 已被棄用。
但是您可以從Jitpack 存盤庫中使用它:
- 將其添加到存盤庫末尾的根 build.gradle 中:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
- 將依賴項添加到您的應用 build.gradle:
dependencies {
implementation 'com.github.kristiyanP:colorpicker:v1.1.10'
}
享受!
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/517625.html
