无法解析:com.google code.gson:GSON:2.3.1 [英] Failed to resolve: com.google.code.gson:gson:2.3.1

查看:6066
本文介绍了无法解析:com.google code.gson:GSON:2.3.1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

错误:(25,13)无法解析:com.google code.gson:GSON:2.3.1

展在项目结构对话框

的build.gradle:应用程序


 应用插件:'com.android.application  安卓{   compileSdkVersion 23
    buildToolsVersion23.0.0 RC2  defaultConfig {
    的applicationIDcom.app.main
    14的minSdkVersion
    targetSdkVersion 23
    版本code 1
    的versionName1.0
}
buildTypes {
    发布 {
        minifyEnabled假
        proguardFiles getDefaultProguardFile('proguard的-android.txt'),proguard-rules.pro
    }
}}库{
    mavenCentral()
}
依赖{
编译文件树(包括:['的* .jar'],DIR:库)
编译com.google code.gson:GSON:2.3.1
编译com.android.support:support-v4:23.0.1
编译com.google.android.gms:播放服务:7.8.0
编译com.facebook.android:facebook-android-sdk:4.5.0
编译com.google.android.gms:播放服务基地:7.8.0
编译com.google.android.gms:播放服务-GCM:7.8.0
编译com.google.android.gms:播放服务,地图:7.8.0
编译com.google.android.gms:播放服务地点:7.8.0
编制项目(':Uni_Image_Lod_Lib')}

builde.gradle:项目


  //顶级构建文件,您可以添加常用的配置选项,所有分项目/模块。 buildscript {
     库{
        jcenter()
 }
依赖{
    类路径'com.android.tools.build:gradle:1.3.0    //注意:不要在这里把你的应用程序依赖关系;他们属于
    //在单个模块的build.gradle文件
}}
  allprojects {
     库{
        jcenter()
      }
  }


步骤如下:

Android的工作室版本1.3.2

重新启动计算机

无效缓存/重新启动

天亮的依赖。

但没有改变。现在是什么将会成为这个解决方案。

经过一些更改

 应用插件:'com.android.application  安卓{   compileSdkVersion 23
    buildToolsVersion23.0.1  defaultConfig {
    的applicationIDcom.app.main
    14的minSdkVersion
    targetSdkVersion 23
    版本code 1
    的versionName1.0
}
buildTypes {
    发布 {
        minifyEnabled假
        proguardFiles getDefaultProguardFile('proguard的-android.txt'),proguard-rules.pro
    }
}}库{
    mavenCentral()
}
依赖{
编译文件树(包括:['的* .jar'],DIR:库)
编译com.google code.gson:GSON:2.3.1
编译com.android.support:support-v4:23.0.1
编译com.google.android.gms:播放服务:7.8.0
编译com.facebook.android:facebook-android-sdk:4.5.0
编制项目(':Uni_Image_Lod_Lib')}

和得到错误重建

同时建立在离线模式下项目检测

未解决的依赖。请禁用脱机模式,然后再试一次。

错误:出现问题的项目配置:应用程序。


  

无法解析配置所有的依赖:应用程序:_debugCompile。
  无法解析com.google code.gson:GSON:2.3.1。
       要求:
           APP:应用程序:未指定
  作者com.google code.gson没有缓存的版本:GSON:2.3.1适用于离线模式。
  作者com.google code.gson没有缓存的版本:GSON:2.3.1适用于离线模式


然后我有看到prefrences->构建,执行,部署 - > gradle这个

项目级别设置为:

勾选使用当地分销的gradle

全局设置的gradle:

脱机工作没有打勾


解决方案

 编译com.google code.gson:GSON:2.3.1

删除 .1 并使其编译

 'com.google code.gson:GSON:2.3

为2.3.1 不稳定和生活还没有,这是ÿ它给你的错误。也从来不使用 + 在编译时其不按我的知识的最佳做法。

Error:(25, 13) Failed to resolve: com.google.code.gson:gson:2.3.1

Show in Project Structure dialog

build.gradle:app


apply plugin:'com.android.application'

  android {

   compileSdkVersion 23
    buildToolsVersion "23.0.0 rc2"

  defaultConfig {
    applicationId "com.app.main"
    minSdkVersion 14
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), proguard-rules.pro'
    }
}}

repositories {
    mavenCentral()
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.android.support:support-v4:23.0.1'
compile 'com.google.android.gms:play-services:7.8.0'
compile 'com.facebook.android:facebook-android-sdk:4.5.0'
compile 'com.google.android.gms:play-services-base:7.8.0'
compile 'com.google.android.gms:play-services-gcm:7.8.0'
compile 'com.google.android.gms:play-services-maps:7.8.0'
compile 'com.google.android.gms:play-services-location:7.8.0'
compile project(':Uni_Image_Lod_Lib')   }

builde.gradle: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()
      }
  }


step follows:

Android Studio Version 1.3.2

Restart computer

Invalidate caches/Restart

up dawn dependency.

but nothing to change. now what will be the solution for this.

After Some Changes

apply plugin:'com.android.application'

  android {

   compileSdkVersion 23
    buildToolsVersion "23.0.1"

  defaultConfig {
    applicationId "com.app.main"
    minSdkVersion 14
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), proguard-rules.pro'
    }
}}

repositories {
    mavenCentral()
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.android.support:support-v4:23.0.1'
compile 'com.google.android.gms:play-services:7.8.0'
compile 'com.facebook.android:facebook-android-sdk:4.5.0'
compile project(':Uni_Image_Lod_Lib')   }

and get error rebuild

Unresolved dependencies detected while building project in offline mode. Please disable offline mode and try again.

Error:A problem occurred configuring project ':app'.

Could not resolve all dependencies for configuration ':app:_debugCompile'. Could not resolve com.google.code.gson:gson:2.3.1. Required by: APP:app:unspecified No cached version of com.google.code.gson:gson:2.3.1 available for offline mode. No cached version of com.google.code.gson:gson:2.3.1 available for offline mode.

then i have see in prefrences-> Build, Execution, deployment -> gradle.

project level setting is:

ticked use local gradle distribution

global gradle setting:

offline work is not ticked

解决方案

compile 'com.google.code.gson:gson:2.3.1'

remove .1 and make it compile

'com.google.code.gson:gson:2.3' 

as 2.3.1 is not stable and live yet, that's y its giving your error. also never use + while compiling as its not a best practice as per my knowledge.

这篇关于无法解析:com.google code.gson:GSON:2.3.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆