【发布时间】:2015-08-20 22:48:42
【问题描述】:
这是一个与今天无关的老问题。请参阅 Android 开发人员的说明。与四年前相比,现在将数据绑定应用于您的项目要容易得多。
我正在阅读来自https://developer.android.com/tools/data-binding/guide.html 的 Android 数据绑定指南。我已确定我运行的是 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"
}
【问题讨论】:
-
你有没有想过这个问题?我所有的东西都在工作,现在不行了。我有 gradle build 1.3.0-beta4 和 com.android.databinding:library:1.0-rc0,buildt 工具版本为 23.0.0 rc3。
-
我刚刚解决了我的问题。删除 android-apt 插件导致一切都解决了。花了两天时间研究这个。希望这可以节省一些时间。
-
我在这里尝试了所有方法,还有什么问题??
标签: android gradle data-binding android-databinding