【发布时间】:2016-07-09 21:24:21
【问题描述】:
我有 android studio v1.4 并且在 gradle 同步中有一些错误。
首先我给出了这个错误:
连接超时:连接。如果您使用 HTTP 代理,请 在 IDE 或 Gradle 中配置代理设置。
我在google上搜索,发现必须在全局gradle设置中开启离线工作
之后我给出了这个错误:
没有 com.android.databinding:dataBinder:1.+ 的缓存版本列表 可用于离线模式。
为了解决这个问题,我发现我必须手动下载预期的文件并将其添加到 android studio。
但我不知道我必须下载什么文件?从哪里来?以及如何添加到android studio?
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:1.3.+'
classpath "com.android.databinding:dataBinder:1.+"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle(模块:app):
apply plugin: 'com.android.application'
apply plugin: 'com.android.databinding'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.example.saeid7laptop.test"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
maven {
url "https://jitpack.io"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.1'
compile project(':Material-Animations-master')
}
【问题讨论】:
-
但是,如果您遇到连接超时,您可能只想检查您是否可以连接到jCenter,您可以在此处下载 jar 文件以供离线使用。
-
如果你正在下载一个新的包,你不能打开“离线工作”。顺便说一句,你在代理后面吗?
标签: android android-gradle-plugin