无法在 android studio 上导入依赖项实现
cant import dependency implementation on android studio
我是 android studio 的初学者,我正在尝试为 DatePickerDialog (link for its github) 库导入远程依赖项,但导入对我不起作用。
我尝试通过 ProjectStructure/dependencies
中显示的组 ID (com.github.wdullaer) 和工件名称 (MaterialDateTimePicker) 导入它
我试过 - 导入 com.github.wdullaer.MaterialDateTimePicker
我也试过 - 导入 com.wdullaer.MaterialDateTimePicker
还有更多,但导入不起作用
但是
这是我的 gradle:
// 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
}
如果有人知道我该如何导入它,那将非常有帮助
这是错误的:
implementation 'com.github.wdullaer:MaterialDateTimePicker:v4.2.3'
首先不要使用v
近版本,所以删除它
你也弄错了路径,再读一遍guide - 你应该使用这个:
implementation 'com.wdullaer:materialdatetimepicker:4.2.3'
我是 android studio 的初学者,我正在尝试为 DatePickerDialog (link for its github) 库导入远程依赖项,但导入对我不起作用。
我尝试通过 ProjectStructure/dependencies
中显示的组 ID (com.github.wdullaer) 和工件名称 (MaterialDateTimePicker) 导入它我试过 - 导入 com.github.wdullaer.MaterialDateTimePicker
我也试过 - 导入 com.wdullaer.MaterialDateTimePicker
还有更多,但导入不起作用 但是
这是我的 gradle:
// 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
}
如果有人知道我该如何导入它,那将非常有帮助
这是错误的:
implementation 'com.github.wdullaer:MaterialDateTimePicker:v4.2.3'
首先不要使用v
近版本,所以删除它
你也弄错了路径,再读一遍guide - 你应该使用这个:
implementation 'com.wdullaer:materialdatetimepicker:4.2.3'