簡體   English   中英

無法在 android studio 上導入依賴項實現

[英]cant import dependency implementation on android studio

我是 android 工作室的初學者,我正在嘗試為 DatePickerDialog 庫導入遠程依賴項(其 github 的鏈接),但導入對我不起作用。

我嘗試按 Group Id (com.github.wdullaer) 和工件名稱 (MaterialDateTimePicker) 導入它,如 ProjectStructure/dependencies 中所示

我試過 - 導入 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近版本,所以只需將其刪除

你也走錯了路,再次閱讀指南- 你應該使用這個:

implementation 'com.wdullaer:materialdatetimepicker:4.2.3'

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM