title: How to fix "Failed to resolve: com.google.gson:gson:2.8.5" in Android studio
body: <p>I am creating an android application using android studio. I want to use the following dependence 'com.google.gson:gson:2.8.5'. I add it into my build.gradle of my app but I encountered the following error :
  Failed to resolve: com.google.gson:gson:2.8.5</p>
  
  <p>I tried the following :
  - downgrade the version of the dependence
  - downgrade the version of the buildToolsVersion
  - install all Google packages available in the SDK
  - add mavenCentral() to my build.gradle project</p>
  
  <p>My build.gradle app :</p>
  
  <pre><code>apply plugin: 'com.android.application'
  
  android {
      compileSdkVersion 29
      buildToolsVersion "29.0.0"
      defaultConfig {
          applicationId "com.example.topquiz"
          minSdkVersion 15
          targetSdkVersion 29
          versionCode 1
          versionName "1.0"
          testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
      }
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
          }
      }
  }
  
  dependencies {
      implementation fileTree(dir: 'libs', include: ['*.jar'])
      implementation 'androidx.appcompat:appcompat:1.0.2'
      implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
      implementation 'com.google.android.material:material:1.0.0'
      testImplementation 'junit:junit:4.12'
      androidTestImplementation 'androidx.test:runner:1.2.0'
      androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
      implementation 'org.jetbrains:annotations-java5:15.0'
      implementation 'com.google.gson:gson:2.8.5' //Store object into SharedPreferences
  }
  </code></pre>
  
  <p>My build.gradle project :</p>
  
  <pre><code>// Top-level build file where you can add configuration options common to all sub-projects/modules.
  
  buildscript {
      repositories {
          google()
          jcenter()
      }
      dependencies {
          classpath 'com.android.tools.build:gradle:3.4.1'
  
          // NOTE: Do not place your application dependencies here; they belong
          // in the individual module build.gradle files
      }
  }
  
  allprojects {
      repositories {
          google()
          jcenter()
          mavenCentral()
      }
  }
  
  task clean(type: Delete) {
      delete rootProject.buildDir
  }
  </code></pre>
  
  <p>Thank you very much for your help</p>