我正在为新的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'
}
点击同步按钮后,出现“实现”错误。
答案 0 :(得分:0)
愚蠢的错误。找到了问题。刚刚删除=运算符
实现=