【问题标题】:Could not set unknown property 'implementation' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler无法为 org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler 类型的对象设置未知属性“实现”
【发布时间】:2020-01-02 15:11:56
【问题描述】:

我正在为新的 android-kotlin 项目添加新的依赖项,但在同步项目后出现以下错误。

无法为类型对象设置未知属性“实现” org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler。

以下是我的 build.gradle 文件。

apply plugin: 'com.android.application'    
apply plugin: 'kotlin-android'    
apply plugin: 'kotlin-android-extensions'    
apply plugin: 'kotlin-kapt'    
apply plugin: 'androidx.navigation.safeargs'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.samplekotlin"
        minSdkVersion 15
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    dataBinding.enabled = true
}

def lifeCycleExtensionVersion = '1.1.1'
def supportVersion = '28.0.0'
def retrofitVersion = '2.3.0'
def glideVersion = '4.9.0'
def rxJavaVersion = '2.1.1'
def roomVersion = '2.1.0-rc01'
def navVersion = '2.1.0-alpha05'
def preferencesVersion = '1.0.0'

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.core:core-ktx:1.0.2'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation = "com.android.support:design:$supportVersion"
    implementation = "android.arch.lifecycle:extension:$lifeCycleExtensionVersion"
    implementation =  "androidx.room:room-runtime:extension:$roomVersion"
    implementation = "androidx.legacy:legacy-support-v4:1.0.0"
    kapt "androidx.room:room-compiler:$roomVersion"
    implementation = "androidx.room:room-ktx:$roomVersion"
    implementation = "org.jetbrains.kotlinx:kotlinx-coroutine-core:1.1.1"

    implementation = "androidx.navigation:navigation-fragment-ktx:$navVersion"
    implementation = "androidx.navigation:navigation-ui-ktx:$navVersion"
    implementation = "com.google.android.material:material:1.0.0"

    implementation = "com.squareup.retrofit2:retrofit:$retrofitVersion"
    implementation = "com.squareup.retrofit2:converter-gson:$retrofitVersion"
    implementation = "com.squareup.retrofit2:adapter-rxjava2:$retrofitVersion"

    implementation = "io.reactivex.rxjava2:rxjava:$rxJavaVersion"
    implementation = "io.reactivex.rxjava2:rxandroid:$rxJavaVersion"

    implementation = "com.github.bumptech.glide:glide:$glideVersion"

    implementation = "com.android.support:palette-v7:$supportVersion"

    implementation = "androidx.preference:preference:$preferencesVersion"

    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}

点击同步按钮后,出现“实施”错误。

【问题讨论】:

    标签: android gradle dependencies implementation kotlin-extension


    【解决方案1】:

    愚蠢的错误。发现问题。刚刚去掉 = 操作符

    实施 =

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-01-02
      • 2020-04-15
      • 1970-01-01
      • 2021-12-19
      • 2018-09-22
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多