简体   繁体   English

数据绑定生成错误,android-sunflower示例

[英]Databinding build error , android-sunflower sample

I want to try Android JetPack (Navigation Component Framework).I downloaded Android Studio 3.3 Canary 2 for this and copied the application from github( https://github.com/googlesamples/android-sunflower ). 我想尝试Android JetPack(导航组件框架)。为此我下载了Android Studio 3.3 Canary 2并从github( https://github.com/googlesamples/android-sunflower )复制了该应用程序。 But I get an error during build. 但是在构建过程中出现错误。

Project Gradle = 项目摇篮=

buildscript {
// Define versions in a single place
ext {
    compileSdkVersion = 28
    minSdkVersion = 19
    targetSdkVersion = 28

    // App dependencies
    constraintLayoutVersion = '1.1.2'
    espressoVersion = '3.0.1'
    glideVersion = '4.4.0'
    gradleVersion = '3.3.0-alpha02'
    gsonVersion = '2.8.2'
    junitVersion = '4.12'
    lifecycleVersion = '1.1.1'
    navigationVersion = '1.0.0-alpha02'
    kotlinVersion = '1.2.50'
    ktlintVersion = '0.24.0'
    ktxVersion = '0.3'
    roomVersion = '1.1.1'
    runnerVersion = '1.0.1'
    supportLibraryVersion = '28.0.0-alpha3'
    workVersion = '1.0.0-alpha04'
}

repositories {
    google()
    jcenter()
}

dependencies {
    classpath "com.android.tools.build:gradle:$gradleVersion"
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
}

App Gradle = 应用程式摇篮=

android {
compileSdkVersion 28
dataBinding {
 enabled = true
}
defaultConfig {
 applicationId "com.google.samples.apps.sunflower"
 minSdkVersion rootProject.minSdkVersion
 targetSdkVersion rootProject.targetSdkVersion
 testInstrumentationRunner 
 "android.support.test.runner.AndroidJUnitRunner"
 versionCode 1
 versionName "0.1.3"
 vectorDrawables.useSupportLibrary true
 javaCompileOptions {
  annotationProcessorOptions {
    arguments = ["room.schemaLocation":
        "$projectDir/schemas".toString()]
   }
   }
 }
 buildTypes {
   release {
    minifyEnabled false
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 
    'proguard-rules.pro'
   }
  }
 compileOptions {
 sourceCompatibility JavaVersion.VERSION_1_8
 targetCompatibility JavaVersion.VERSION_1_8
  }

  kapt { generateStubs = true } 
  }

 dependencies {

 kapt "android.arch.persistence.room:compiler:$rootProject.roomVersion"
 kapt "com.github.bumptech.glide:compiler:$rootProject.glideVersion"

implementation 
"android.arch.lifecycle:extensions:$rootProject.lifecycleVersion"
implementation "android.arch.navigation:navigation-fragment- 
ktx:$rootProject.navigationVersion"
implementation "android.arch.navigation:navigation-ui- 
ktx:$rootProject.navigationVersion"
implementation 
"android.arch.persistence.room:runtime:$rootProject.roomVersion"
implementation "android.arch.work:work-runtime- 
ktx:$rootProject.workVersion"
implementation "androidx.core:core-ktx:$rootProject.ktxVersion"
implementation "com.android.support:appcompat- 
v7:$rootProject.supportLibraryVersion"
implementation "com.android.support:support- 
v4:$rootProject.supportLibraryVersion"
implementation "com.android.support:recyclerview- 
v7:$rootProject.supportLibraryVersion"
implementation "com.android.support.constraint:constraint- 
layout:$rootProject.constraintLayoutVersion"
implementation 
"com.android.support:design:$rootProject.supportLibraryVersion"
implementation 
"com.github.bumptech.glide:glide:$rootProject.glideVersion"
implementation "com.google.code.gson:gson:$rootProject.gsonVersion"
implementation "org.jetbrains.kotlin:kotlin-stdlib- 
jdk8:$rootProject.kotlinVersion"

// Testing dependencies
androidTestImplementation "com.android.support.test.espresso:espresso- 
contrib:$rootProject.espressoVersion"
androidTestImplementation "com.android.support.test.espresso:espresso- 
core:$rootProject.espressoVersion"
testImplementation "junit:junit:$rootProject.junitVersion"
}

Error enter image description here 错误在此处输入图片说明

Thank you 谢谢

You can try Android JetPack (Navigation Component Framework) on Android 3.2 Canary 14 or higher. 您可以在Android 3.2 Canary 14或更高版本上尝试使用Android JetPack(导航组件框架)。 As tell us here https://developer.android.com/topic/libraries/architecture/navigation/navigation-implementing?utm_source=android-studio&utm_medium=studio-assistant 就像在这里告诉我们https://developer.android.com/topic/libraries/architecture/navigation/navigation-implementing?utm_source=android-studio&utm_medium=studio-assistant

you can try with Android Studio 3.2 Beta 2. 您可以尝试使用Android Studio 3.2 Beta 2。

Althought I am not reproducing the issue by just downloading the project and running it on 3.3 Canary 2. 虽然我不是通过下载项目并在3.3 Canary 2上运行它来重现该问题。

do you change something apart of the gradle version that is needed? 您是否更改了需要的gradle版本以外的内容?

Greetings. 问候。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM