Jaythaking Jaythaking - 6 months ago 45
Android Question

How to know what Support Library to import

I had this issue where I overflow the 64k memory when compiling all the library I use. I started having this issue again when I added that one

'com.android.support:appcompat-v7:23.3.0'
that seems to be huge. Currently, this is the features I need :


  • RecyclerView

  • CardView

  • Vector support (vectorDrawables.useSupportLibrary = true)

  • Multidex (when I can't be below 64k)...



I'm lost when it comes to import just the required needed library. Is there a chart somewhere that list all the included features for each library and what to not import when it's already included in another library.

This is my current imports:

dependencies {

compile('com.android.support:design:23.3.0') {
exclude module: 'support-v4'
}
compile('com.android.support:cardview-v7:23.1.0') {
exclude module: 'support-v4'
}

compile 'com.android.support:multidex:1.0.0'
compile 'com.android.support:appcompat-v7:23.3.0'

compile('com.google.android.gms:play-services-gcm:8.4.0') {
exclude module: 'support-v4'
}

compile('com.firebase:firebase-client-android:2.4.0') {
exclude module: 'jackson-databind'
}

compile('com.github.nkzawa:socket.io-client:0.4.1') {
exclude group: 'org.json', module: 'json'
}

compile('com.astuetz:pagerslidingtabstrip:1.0.1') {
exclude module: 'support-v4'
}

compile 'commons-io:commons-io:2.4'
compile 'com.google.android.gms:play-services-location:8.4.0'
}

Answer

You can open the terminal and run command gradlew app:dependencies to test which dependencies are already included in the others as transitive dependencies for your project along with the respective versions of each.

For example I got the following dependency chart for one of my projects for the com.android.support:design library I used:

+--- com.android.support:design:23.3.0
|    +--- com.android.support:appcompat-v7:23.3.0
|    |    +--- com.android.support:support-vector-drawable:23.3.0
|    |    |    \--- com.android.support:support-v4:23.3.0
|    |    |         \--- com.android.support:support-annotations:23.3.0
|    |    +--- com.android.support:animated-vector-drawable:23.3.0
|    |    |    \--- com.android.support:support-vector-drawable:23.3.0 (*)
|    |    \--- com.android.support:support-v4:23.3.0 (*)
|    +--- com.android.support:support-v4:23.3.0 (*)
|    \--- com.android.support:recyclerview-v7:23.3.0
|         +--- com.android.support:support-v4:23.3.0 (*)
|         \--- com.android.support:support-annotations:23.3.0
Comments