android - Gradle 找不到 com.android.databinding :dataBinder:1. 0-rc0

标签 android gradle data-binding android-databinding

这是一个与今天无关的老问题。请参阅 Android 开发人员的说明。与四年前相比,现在将数据绑定(bind)应用于您的项目要容易得多。

我正在阅读 https://developer.android.com/tools/data-binding/guide.html 中的 Android 数据绑定(bind)指南.我已确定我运行的是 Android Studio 1.3(金丝雀版)。

按照指南,我收到此错误:

Gradle sync failed: could not find com.android.databinding:library:1.0-rc0

其他人有同样的问题吗?感谢您的帮助。

应用构建.gradle

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.3.0-beta1'
        classpath "com.android.databinding:dataBinder:1.0-rc0"
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

模块构建.graddle

apply plugin: 'com.android.application'
apply plugin: 'com.android.databinding'

apply plugin: 'android-apt'
def AAVersion = '3.3'
def MyProject = 'com.commonsware.android.frw.filesdemo'

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
    }
}

repositories {
    mavenCentral()
}

apt {
    arguments {
        androidManifestFile variant.outputs[0].processResources.manifestFile
        resourcePackageName "$MyProject"
    }
}

android {
    compileSdkVersion 22
    buildToolsVersion "22"

    defaultConfig {
        applicationId "$MyProject"
        minSdkVersion 17
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    packagingOptions{
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/services/com.fasterxml.jackson.core.JsonFactory'
    }

    dexOptions {
        preDexLibraries = false
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.0.0'

    compile "com.squareup:otto:1.3.6"
    compile "commons-io:commons-io:+"
    compile 'com.fasterxml.jackson.jr:jackson-jr-all:2.5.0'
    compile 'com.astuetz:pagerslidingtabstrip:1.0.1'

    apt "org.androidannotations:androidannotations:$AAVersion"
    compile "org.androidannotations:androidannotations-api:$AAVersion"
}

最佳答案

我遇到了这个问题,并通过在我的顶级 build.gradle 中的 allprojects.repositories 下添加“jcenter”来解决它(我一直在使用 mavenCentral)。

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.3.0'
        classpath 'com.android.databinding:dataBinder:1.0-rc1'
    }
}

allprojects {
    repositories {
        mavenCentral()
        jcenter() // <=== *** Adding this fixed it ***
    }
}

关于android - Gradle 找不到 com.android.databinding :dataBinder:1. 0-rc0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30675787/

相关文章:

android - Flutter:任务 ':app:validateSigningRelease' 执行失败。 > keystore 文件未设置用于签名配置发布

android - UV 和顶点的单独索引

android - 将 Firebase 主题消息与 Android 通知 channel 一起使用

android - 如何使用Android Studio在Android L或4.4上运行应用程序?

android - Gradle Sync 在 0.4.6 升级后无法完成

mvvm - 绑定(bind)到模型以进行属性更改

android 包 *.databinding 不存在

wpf - 如果 ListBox 使用数据绑定(bind),如何在加载时正确设置焦点?

android - 创建客户端 ID : "An unexpected error has occurred. We' re looking into it. 时“

gradle - gradle构建始终在下载随机插件时失败