How to fix “Failed to resolve: com.google.gson:gson:2.8.5” in Android studio

后端 未结 3 2035
故里飘歌
故里飘歌 2021-01-20 18:17

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

相关标签:
3条回答
  • 2021-01-20 19:02

    The groupID should be com.google.code.gson instead of com.google.gson.

    implementation 'com.google.code.gson:gson:2.8.5'
    

    Change it to the above, resync the project, and the error should go away.

    0 讨论(0)
  • 2021-01-20 19:06

    Alternatively: gradle doesn't play nice with what you need here. I would try replacing the line implementation 'com.google.gson:gson:2.8.5' with this:

    compile group: 'com.google.code.gson', name: 'gson', version: '2.8.5'
    
    0 讨论(0)
  • 2021-01-20 19:12

    Try this -

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

    And in project gradle -

    classpath 'com.google.gms:google-services:4.2.0'
    
    0 讨论(0)
提交回复
热议问题