Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gradle android studio 2.3: failed to resolve 'com.google.code.gson:gson:2.8.0'

i'm facing the gradle error failed to resolve while including gson libraries.

I already checked for similar problem here, here and here but none of the solution proposed was suitable to me, i continue receiving the same error.

My build.gradle module:

android {
    compileSdkVersion 24
    buildToolsVersion '25.0.0'
}

repositories {
    mavenCentral()
}

dependencies {
    compile 'com.google.code.gson:gson:2.8.0'
}

build.gradle project

buildscript {
repositories {
    mavenCentral()
    jcenter()
}
allprojects {
repositories {
    mavenCentral()
    jcenter()
}

As suggested in the answers it should be enough jcenter repository, as it is a superset of mavenCentral, i tried also different versions of gson, adding "+" et cetera but nothing is working.

Thanks in advance guys :)

like image 656
Fabio Avatar asked Mar 09 '17 17:03

Fabio


2 Answers

try using this in your app level build.gradle file

compile 'com.google.code.gson:gson:2.7'
like image 198
Krishna Meena Avatar answered Nov 15 '22 00:11

Krishna Meena


Dear Fabio Add like this

compile 'com.android.support:multidex:1.0.1'
compile 'com.google.code.gson:gson:2.8.0'

see in attached snap enter image description here

Thanks

like image 44
Dharmeshsharma Avatar answered Nov 15 '22 00:11

Dharmeshsharma