1
Talk guys, all right?
Someone there has used the Gson library in the same project where the Facebook SDK was used?
The problem happened when I used the Facebook SDK to allow logging into the application through the Facebook account. This routine also worked perfectly, but it makes the Gson bugar.
In practice, I am using the following dependencies in my Gradle:
compile 'com.facebook.android:facebook-android-sdk:4.8.1'
compile 'com.google.code.gson:gson:2.7'
In the code, the error happens when I try to instantiate Gson, on that line:
Gson g = new Gson();
And the mistake that happens is this:
Caused by: java.lang.VerifyError: com/google/gson/Gson
I’ve researched a lot and found people with similar errors, so I understand the Facebook SDK also uses Gson, so this conflict happens. Some solutions I found for this type of problem are as follows, but none of them solved my problem:
Add mavenCentral() to repositories: I’ve done but not solved.
repositories {
mavenCentral()
}
Give an "exclude" on Facebook SDK Gson: also tried and did not work.
First, thank you for answering! But I can’t switch to false, because I have more than 64k methods in my file. Dex (according to the error that is presented to me). I will put the error in another comment to organize better:
– Silvio Ereno Quincozes
Error:The number of method References in a . Dex file cannot exceed 64K. Learn how to resolve this Issue at https://developer.android.com/tools/building/multidex.html </code>
– Silvio Ereno Quincozes