Here are two cases to consider
First, consider removing Gson if you declared it in app / build.gradle
dependencies {compile 'com.google.code.gson: gson: 2.4'}
Secondly, if you did not declare it in your app/build.gradle , you may need to investigate which libraries duplicate to declare a Gson dependency. Then you can exclude Gson from this library. You can check this Transitive Dependency Exception
Here I will give an example of an exception of appcompat-v7 from the library
Run this command to see the dependency diagram tree
./gradlew app:dependencies
It will display a dependency tree, as an example below
| \--- com.mikepenz:materialdrawer:4.6.3 | +--- com.android.support:appcompat-v7:23.1.1 (*) | +--- com.android.support:recyclerview-v7:23.1.1 (*) | +--- com.mikepenz:materialize:0.5.1 | | \--- com.android.support:appcompat-v7:23.1.1 (*) | +--- com.mikepenz:iconics-core:2.5.3 | | \--- com.android.support:appcompat-v7:23.1.1 (*) | \--- com.android.support:support-annotations:23.1.1
Once you find that the library has declared a duplicate dependency. You can start to exclude it.
dependencies { compile("com.mikepenz:materialdrawer:4.6.3") { exclude module: 'appcompat-v7' } }
THANN Phearum
source share