javaandroidgsonjcenter

What is the alternative to Gson in android studios


here is the screenshot I am developing an android application for my college project and I ran into an error; " Cannot resolve symbol Gson".

I tried adding the jcenter() repository in my build config to resolve the problem....but still it's not working. Later I came to know that jcenter() had been deprecated...Now how do I resolve my problem?? Any advice would be appreciated


Solution

  • Don't include the jcenter() repository in your build config to avoid getting outdated dependencies. according to the official documentation https://developer.android.com/studio/build/jcenter-migration

    You can use mavenCentral(), in your project level build.gradle add repositories { google() // Google's Maven repository mavenCentral() // Maven Central repository } and in app level build.gradle add implementation group: 'com.google.code.gson', name: 'gson', version: '2.10'