0

Here is the result when I run ./gradlew app:dependencies:

+--- com.android.volley:volley:1.1.1
+--- com.squareup.picasso:picasso:2.71828
|    +--- com.squareup.okhttp3:okhttp:3.10.0
|    |    \--- com.squareup.okio:okio:1.14.0
|    +--- androidx.annotation:annotation:1.0.0 -> 1.1.0
|    \--- androidx.exifinterface:exifinterface:1.0.0
|         \--- androidx.annotation:annotation:1.0.0 -> 1.1.0
\--- com.myapp:commonlib:1.0.2
     +--- com.android.volley:volley:1.1.1
     \--- com.squareup.picasso:picasso:2.71828 (*)

(*) - dependencies omitted (listed previously)

The last line indicates that picasso:2.71828 has been omitted since it appeared before.

My questions are:

  1. volley:1.1.1 (the second-last line) also appeared before on line 1, why didn't it be omitted (no (*) in the end of that line)?
  2. Will the duplicate libraries increase the APK size?

Thanks.

iForests
  • 6,757
  • 10
  • 42
  • 75
  • Please read this, Hope it'll help you https://stackoverflow.com/questions/30648172/gradle-library-duplicates-in-dependencies – Viral Patel Sep 19 '19 at 07:57

1 Answers1

0
  1. The duplicate libraries will increase the Apk size since they are all packaged by gradle while building the final APK or app bundle
  2. The dependencies will not be omitted because they are coming from two different libraries and no rule has been specified to omit them.
  3. You can exclude the duplicate libs manually by gradle options

    Exclude dependencies from your build.gradle file

     dependencies {
           implementation('some-library') {
            exclude group: 'com.example.imgtools', module: 'native'
           }
        }
Mayuri Khinvasara
  • 1,437
  • 1
  • 16
  • 12