2

我正在尝试实现一个新功能“您现在可以将 LiveData 对象用作数据绑定表达式中的可观察字段”,正如文档所述https://androidstudio.googleblog.com/2017/12/android-studio-31-canary -6-is-now.html 下载 AS 3.1 beta 后,我无法编译我的项目,我收到不同的消息,例如“在项目上找不到参数 [com.android.databinding:compiler:2.3.0] 的方法 kapt()”: org.gradle.api.Project 类型的应用程序”

这是我的gradle文件:

// Top-level build file where you can add configuration options common to all 
sub-projects/modules.

buildscript {
ext.kotlin_version = '1.2.30'
ext.google_ver = '27.1.0'
ext.google_play_ver = '11.8.0'
ext.retrofit_ver = '2.3.0'
ext.arch_components_ver = '1.1.1'

repositories {
    jcenter()
    google()
    maven { url "https://kotlin.bintray.com/kotlinx" }

    mavenLocal()
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.2.0-alpha07'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
    classpath 'com.google.gms:google-services:3.1.2'
}
}
allprojects {
repositories {
    jcenter()
    mavenCentral()
    maven { url "https://jitpack.io" }
    maven {
        url "https://maven.google.com"
    }
    maven { url "https://kotlin.bintray.com/kotlinx" }
    google()
    flatDir { dirs 'libs' }
}
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

应用程序.gradle

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

androidExtensions {
    experimental = true
}




android {
compileSdkVersion 27
defaultConfig {
    applicationId "xxx"
    minSdkVersion 19
    targetSdkVersion 27
    versionCode 1
    versionName "1.0"
    multiDexEnabled true
    dataBinding {
        enabled = true
    }
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 
'proguard-rules.pro'
    }
}
}

kapt {
    generateStubs = true
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "com.android.support:support-v4:$google_ver"
implementation 'com.android.support:support-v4:27.1.0'
compile fileTree(include: ['*.jar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version".0.2'
implementation "com.android.support:design:$google_ver"
implementation "com.android.support:appcompat-v7:$google_ver"
implementation 'devs.mulham.horizontalcalendar:horizontalcalendar:1.1.7'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation 'com.bluelinelabs:conductor:2.1.4'
implementation 'com.bluelinelabs:conductor-support:2.1.4'
implementation 'com.jakewharton.threetenabp:threetenabp:1.0.5'
implementation 'com.annimon:stream:1.1.7'
implementation "com.squareup.retrofit2:retrofit:$retrofit_ver"
implementation "com.squareup.retrofit2:adapter-rxjava2:$retrofit_ver"
implementation 'com.squareup.retrofit2:converter-moshi:2.0.0'
implementation "com.squareup.retrofit2:retrofit:$retrofit_ver"
implementation "com.squareup.retrofit2:converter-gson:$retrofit_ver"
implementation 'com.squareup.moshi:moshi-kotlin:1.5.0'
implementation 'io.reactivex.rxjava2:rxjava:2.1.7'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
implementation 'jp.wasabeef:glide-transformations:3.0.1'
implementation 'com.fasterxml.jackson.module:jackson-module-kotlin:2.9.0'
implementation "com.android.support:support-v4:$google_ver"
implementation "com.google.android.gms:play-services-maps:$google_play_ver"
implementation "com.google.android.gms:play-services-gcm:$google_play_ver"
implementation 'com.makeramen:roundedimageview:2.3.0'
implementation 'com.google.code.gson:gson:2.8.0'
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
implementation 'com.squareup.okhttp3:logging-interceptor:3.4.1'
implementation 'com.cleveroad:slidingtutorial:0.9.5'
implementation 'io.reactivex:rxjava:1.3.2'
//camera
implementation 'io.fotoapparat.fotoapparat:library:1.4.1'
implementation 'id.zelory:compressor:2.1.0'
//ui
implementation 'com.davemorrissey.labs:subsampling-scale-image-view:3.9.0'
implementation 'com.akexorcist:RoundCornerProgressBar:2.0.3'
implementation 'com.ebanx:swipe-button:0.8.3'
implementation 'com.github.ViksaaSkool:AutoFitEditText:53238e2d29'
implementation 'ru.egslava:MaskedEditText:1.0.5'
implementation 'org.jetbrains.anko:anko-common:0.8.3'
implementation 'com.rengwuxian.materialedittext:library:2.1.4'
implementation 'com.afollestad.material-dialogs:core:0.9.6.0'
//    rxBinding
implementation 'com.jakewharton.rxbinding:rxbinding:1.0.0'

implementation 'com.android.support.constraint:constraint-layout:1.0.2'

// ViewModel and LiveData
implementation "android.arch.lifecycle:extensions:$ext.arch_components_ver"
implementation "android.arch.lifecycle:common-java8:$ext.arch_components_ver"
implementation "android.arch.lifecycle:reactivestreams:$ext.arch_components_ver"
}

真的很郁闷(

4

1 回答 1

2

好的,如果您使用的是 'com.android.tools.build:gradle:3.2.0-alpha07' 的话,请删除这些行

androidExtensions {
experimental = true
}
于 2018-03-23T20:09:12.360 回答