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.
You can simply do following:
buildscript {
repositories {
mavenCentral() //Add following
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
}
}
allprojects {
repositories {
mavenCentral() // Add following
jcenter()
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With