【问题标题】:Does binding class will generate automatically?绑定类会自动生成吗?
【发布时间】:2015-11-10 03:13:31
【问题描述】:

我正在开发一个带有谷歌数据绑定库的应用程序。但是我发现每次我添加一个新的布局 xml 并且相应的绑定类都不会生成。我必须在android studio上点击构建按钮,然后绑定类就会生成。

这是我使用的依赖项

应用构建等级:

apply plugin: 'com.android.application'
apply plugin: 'com.android.databinding'
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'com.jakewharton.hugo'
apply plugin: 'com.fernandocejas.frodo'

android {
    signingConfigs {
    }
    compileSdkVersion 23
    buildToolsVersion '23.0.2'
    defaultConfig {
        applicationId "com.xinpinget.gamecube"
        minSdkVersion MIN_SDK_VERSION as int
        targetSdkVersion TARGET_SDK_VERSION as int
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }

        debug {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    productFlavors {
        production {
            signingConfig signingConfigs.config
        }
        internal {
        }
    }
//    dexOptions {
//        incremental true
//    }
}

retrolambda {
    jdk "/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home"
    oldJdk System.getenv("JAVA_HOME")
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile project(':insta-filter-release')
    compile project(':library-debug')
    compile('com.facebook.fresco:fresco:0.7.0') {
        exclude module: 'support-v4'
    }
    provided 'com.squareup.dagger:dagger-compiler:1.2.2'
    //    apt ('com.squareup.dagger:dagger-compiler:1.2.2') {

    //    }
    compile('com.android.support:design:23.0.1') {
        exclude module: 'support-v4'
        exclude module: 'appcompat-v7'
    }
    compile('io.reactivex:rxandroid:1.0.1') {
        exclude module: 'rxjava'
    }
    compile('io.reactivex:rxjava-debug:1.0.2') {
        exclude module: 'rxjava'
    }
    compile('com.squareup.retrofit:adapter-rxjava:2.0.0-beta2') {
        exclude module: 'rxjava'
    }
    internalCompile 'com.squareup.retrofit:retrofit-mock:2.0.0-beta1'
    internalCompile 'com.squareup.retrofit:adapter-rxjava-mock:2.0.0-beta1'
    compile('com.squareup.retrofit:converter-gson:2.0.0-beta2') {
        exclude module: 'retrofit'
    }
    compile('com.umeng:fb:5.4.0') {
        /**
         *  If not exclude message module, gradle will throw a error when building.
         */
        exclude module: 'message'
        exclude module: 'support-v4'
    }
    compile 'com.android.support:appcompat-v7:23.1.0'
    compile 'com.github.bumptech.glide:glide:3.6.1'
    compile 'com.squareup:otto:1.3.8'
    compile 'com.jakewharton:butterknife:7.0.1'
    compile 'com.squareup.dagger:dagger:1.2.2'
    compile 'io.reactivex:rxjava:1.0.14'
    compile 'com.squareup.retrofit:retrofit:2.0.0-beta2'
    compile 'com.android.support:recyclerview-v7:23.1.0'
    compile 'com.android.support:support-v4:23.1.0'
    compile project(':ShareSDK_oneKeyShare')
    compile project(':sMSSDK')
    compile 'com.android.support:cardview-v7:23.1.0'
}

【问题讨论】:

    标签: android data-binding


    【解决方案1】:

    我解决了这个问题。

    这是由 android-apt 引起的。 https://bitbucket.org/hvisser/android-apt/issues/38/android-apt-breaks-brand-new-data-binding

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-04-05
      • 1970-01-01
      相关资源
      最近更新 更多