gpt4 book ai didi

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

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

这是一个与今天无关的老问题。请参阅 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/

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