Reputation: 764
I have gson2.2.4.jar in my android project folder(/libs/gson2.2.4.jar) and retrofit is conflicting with this. For that, I have to use gson 2.8.5 version. I cannot delete lib/gson2.2.4.jar as it is copied via a build tool. is there anyway override this libs folder version with gradle entry?
Thanks
Upvotes: 0
Views: 162
Reputation: 2160
You need access your build tool code that is adding lib/gson2.2.4 and remove the logic which is adding that lib. If you don't have access or can't ask person who have access to that then what you can do is avoid gson from retrofit.
You can do that using following code:
implementation('com.squareup.retrofit2:retrofit:x.x.x') {
exclude module: 'gson'
}
You need to review your code thoroughly if applying old version of a library do not causes any issues with Retrofit or your implementation.
Upvotes: 0
Reputation: 466
Maybe you should exclude like below:
compile fileTree(dir: 'libs', excludes: ['gson2.2.4.jar'], include: '*.jar')
Upvotes: 1
Reputation: 1925
First delete your gson2.2.4.jar.
If you can't do that then follow this steps.
.gradle
and .idea
folder from your project directoryapp
directory delete build
directory. implementation 'com.squareup.retrofit2:retrofit:2.6.0'
implementation 'com.squareup.retrofit2:converter-gson:2.6.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.12.1'
implementation 'com.google.code.gson:gson:2.8.5'
Hope this will helps you.
Upvotes: 0