安卓:科特林如何解决数据绑定错误

问题描述 投票:1回答:1

当我尝试运行project.It看起来像thisenter image description here使用科特林与Android视觉API脸detection.The构建IM失败

它给科特林编译errors.I猜想肯定是关于科特林绑定某些版本冲突,gradle这个etc.I尝试了各种答案在计算器的职位像this但无法找到解决方案。

这是我的build.gradle(APP)

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

apply plugin: 'kotlin-kapt'

android {
compileSdkVersion 27
buildToolsVersion '28.0.3'
defaultConfig {
    applicationId "com.android.ex1"
    minSdkVersion 16
    targetSdkVersion 27
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner         "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

dataBinding {
    enabled = true
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'

implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.google.android.gms:play-services-vision:11.8.0'
kapt "com.android.databinding:compiler:3.2.0-alpha10"

implementation "android.arch.persistence.room:runtime:1.0.0"
kapt "android.arch.persistence.room:compiler:1.0.0"
}

这是我的build.gradle(根)

buildscript {
ext.kotlin_version = '1.3.10'
ext.gradle_version = '3.2.0-alpha10'
repositories {
    google()
    jcenter()
    maven { url "https://maven.google.com" }
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.3.1'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.10"
    classpath 'com.google.gms:google-services:4.2.0'
    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}
}

allprojects {
repositories {
    google()
    jcenter()
    maven { url "https://maven.google.com" }
}
}

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

任何帮助将是非常useful.Thanks提前!

android kotlin android-gradle build.gradle
1个回答
0
投票

请检查该

    ext.gradle_version = '3.2.0-alpha10'

   classpath 'com.android.tools.build:gradle:3.3.1'

   kapt "com.android.databinding:compiler:3.2.0-alpha10"

gradle这个版本不一样

© www.soinside.com 2019 - 2024. All rights reserved.