gpt4 book ai didi

android - Gradle 2.3.0-alpha1 无法进行数据绑定(bind)

转载 作者:IT老高 更新时间:2023-10-28 23:25:00 27 4
gpt4 key购买 nike

我今天更新到 Android Studo 2.3 Canary 后遇到问题。

构建完成没有错误,但是当我运行应用程序时,gradle 控制台一直显示:

android.databinding.annotationprocessor.ProcessDataBinding not found

这是我的 build.gradle

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

buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle 2.3.0-alpha1'
classpath 'com.google.gms:google-services:3.0.0'
classpath 'com.android.databinding:dataBinder:1.0-rc1'
classpath 'me.tatarka:gradle-retrolambda:3.3.1'
classpath 'me.tatarka.retrolambda.projectlombok:lombok.ast:0.2.3.a2'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}

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

谢谢!

---更新---我挣扎了几天,我发现问题出在哪里。我在我的应用程序中使用 Parcels、Retrolamdas,两个库都使用“apt”,这就是问题。

build.gradle (root) 错误版本:

buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.google.gms:google-services:3.0.0'
classpath 'com.android.databinding:dataBinder:1.0-rc1'
classpath "me.tatarka:gradle-retrolambda:3.2.3"
classpath 'me.tatarka.retrolambda.projectlombok:lombok.ast:0.2.3.a2'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}

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

**build.gradle (app) 错误版本**

apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'android-apt'

...

dependencies {
compile 'org.parceler:parceler-api:1.1.5'
apt 'org.parceler:parceler:1.1.5'
}

这里是固定的。build.gradle (root) 固定版本:

buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0-alpha1'
classpath 'com.google.gms:google-services:3.0.0'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'me.tatarka:gradle-retrolambda:3.3.1'
}
}

allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}

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

build.gradle (app) 固定版本*

apply plugin: 'com.android.application'
apply plugin: 'me.tatarka.retrolambda'

compile 'org.parceler:parceler-api:1.1.5'
annotationProcessor 'org.parceler:parceler:1.1.5'

结论。我更改了retrolamdas repo 版本并删除了插件:'android-apt'.我找到了一些有用的链接,如果您想了解详细信息。

https://github.com/johncarl81/parceler/issues/201 https://bitbucket.org/hvisser/android-apt/wiki/Migration

希望对你有帮助:D

最佳答案

触发此问题是因为我们已将数据绑定(bind)移至 annotationProcessor 配置(而不是提供)。如果您使用的是 android-apt`,它们会发生冲突,请停止使用它。我们还有另一个错误,它阻止它选择其他处理器。它已经修复,将在下一个 Alpha 版中提供。

此处的原始错误报告:https://code.google.com/p/android/issues/detail?id=227612 .如果您确实需要使用 2.3,它也可以解决。

关于android - Gradle 2.3.0-alpha1 无法进行数据绑定(bind),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40562477/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com