我是 android studio 的初學者,我正在嘗試為 DatePickerDialog 庫匯入遠程依賴項(其 github 的鏈接),但匯入對我不起作用。
我嘗試通過 Group Id (com.github.wdullaer) 和 Artifact Name (MaterialDateTimePicker) 匯入它,如 ProjectStructure/dependencies 中所示
我試過 - 匯入 com.github.wdullaer.MaterialDateTimePicker
我也試過 - 進口 com.wdullaer.MaterialDateTimePicker
還有更多,但匯入不起作用,但是
這是我的畢業典禮:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.4"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
這是 DateTimePicker 實作:
plugins {
id 'com.android.application'
id 'kotlin-android'
}
android {
compileSdk 32
defaultConfig {
applicationId "com.example.speedq"
minSdk 21
targetSdk 32
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
}
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures {
viewBinding true
}
}
dependencies {
implementation 'com.github.wdullaer:MaterialDateTimePicker:v4.2.3' // this is the implementation I cant import
}
如果有人知道如何匯入它,那將非常有幫助
uj5u.com熱心網友回復:
那是錯的:
implementation 'com.github.wdullaer:MaterialDateTimePicker:v4.2.3'
首先不要使用v近版本,所以只需將其洗掉
你也走錯了路,再次閱讀指南- 你應該使用這個:
implementation 'com.wdullaer:materialdatetimepicker:4.2.3'
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/418197.html
標籤:
下一篇:如何添加滑動以重繪我的代碼?
