gpt4 book ai didi

android - BR无法解决

转载 作者:行者123 更新时间:2023-12-02 01:05:15 25 4
gpt4 key购买 nike

我猜由于 gradle 中的某些问题,我无法添加 notificationPropertyChanged(int itemId)!

任何帮助将不胜感激

public class RegisterForm extends BaseObservable {
@Bindable
public String firstName;


@Bindable
public int getFirstNameLabelVisibility(){
return TextUtils.isEmpty(firstName) ? View.INVISIBLE : View.VISIBLE;
}

public void setFirstNameFromView(String firstNameFromView) {
firstName = firstNameFromView;

// notifyPropertyChanged(BR.firstName); this line is giving error!
}


}

Build.gradle//对于应用程序

apply plugin: 'com.android.application'
apply plugin: 'com.android.databinding'
apply plugin: 'android-apt'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"

defaultConfig {
applicationId "com.example.jivrajsingh.databindingimp"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
configurations {
apt
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
apt 'com.android.databinding:compiler:1.0-rc0'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.squareup.okhttp:okhttp:2.4.0'
compile 'com.google.android.gms:play-services-auth:8.3.0'
compile 'com.google.android.gms:play-services-gcm:8.3.0'
}

Build.gradle//用于项目

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



buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0-alpha1'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
// classpath 'com.android.tools.build:gradle:1.3.0'
classpath 'com.android.databinding:dataBinder:1.0-rc2'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.+'
}
}

allprojects {
repositories {
jcenter()
}
}

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

感谢您宝贵的时间:)

最佳答案

您有旧的插件设置和新的 gradle 版本。从类路径中删除数据绑定(bind)插件及其依赖项。现在它已集成,您所需要的只是

android {
dataBinding { enabled = true }
}

http://developer.android.com/tools/data-binding/guide.html

关于android - BR无法解决,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34088732/

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