Android版的gradle工作室无法识别com.google code.gson:GSON:2.3.1 [英] Android studio gradle not recognise com.google.code.gson:gson:2.3.1
本文介绍了Android版的gradle工作室无法识别com.google code.gson:GSON:2.3.1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用Android版的gradle开发工作室应用。我加入这个依赖它:
编译com.android.support:appcompat-v7:23.0.1
编译com.squareup.retrofit:改造:1.9.0
编译com.google code.gson:GSON:2.3.1
但它说:
错误:发生了配置工程:应用程序。
>无法下载gson.jar(com.google code.gson:GSON:2.3.1)
>无法获取资源'https://jcenter.bintray.com/com/google/$c$c/gson/gson/2.3.1/gson-2.3.1.jar。
>不能让'https://jcenter.bintray.com/com/google/$c$c/gson/gson/2.3.1/gson-2.3.1.jar。
>连接https://jcenter.bintray.com拒绝
我的build.gradle文件的完整的源
项目:
//顶级构建文件,您可以添加常用的配置选项,所有分项目/模块。buildscript {
库{
jcenter() }
依赖{
类路径'com.android.tools.build:gradle:1.3.0 //注意:不要在这里把你的应用程序依赖关系;他们属于
//在单个模块的build.gradle文件
}
}allprojects {
库{
jcenter()
}
}
应用:
应用插件:'com.android.application
安卓{
compileSdkVersion 23
buildToolsVersion23.0.1 defaultConfig {
的applicationIDdomain.myapplication
11的minSdkVersion
targetSdkVersion 23
版本code 1
的versionName1.0
}
buildTypes {
发布 {
minifyEnabled假
proguardFiles getDefaultProguardFile('proguard的-android.txt'),'proguard-rules.pro
}
}
}依赖{
编译文件树(导演:'库',包括:['的* .jar'])
编译com.android.support:appcompat-v7:23.0.1
编译com.squareup.retrofit:改造:1.9.0
编译com.google code.gson:GSON:2.3.1}
解决方案
定义这个你中的gradle构建脚本。
buildscript {
库{
mavenCentral()
jcenter()
}
依赖{
...
}
}allprojects {
库{
mavenCentral()
}
}
Developing app with Android studio using gradle. I have added this dependencies to it:
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.google.code.gson:gson:2.3.1'
but it says :
Error:A problem occurred configuring project ':app'.
> Could not download gson.jar (com.google.code.gson:gson:2.3.1)
> Could not get resource 'https://jcenter.bintray.com/com/google/code/gson/gson/2.3.1/gson-2.3.1.jar'.
> Could not GET 'https://jcenter.bintray.com/com/google/code/gson/gson/2.3.1/gson-2.3.1.jar'.
> Connection to https://jcenter.bintray.com refused
Full source for my build.gradle files
Project:
// 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.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
App:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "domain.myapplication"
minSdkVersion 11
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.google.code.gson:gson:2.3.1'
}
解决方案
Define this in you gradle build script.
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
...
}
}
allprojects {
repositories {
mavenCentral()
}
}
这篇关于Android版的gradle工作室无法识别com.google code.gson:GSON:2.3.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文