简体   繁体   中英

Remove unecessary gradle imports

During the development of my app I used to import any support library i might use, now my code is more mature and ready for production and i'm trying to remove unecessary imports. is there an easy way to know which of the support library apis i'm really using?

I tried to comment one by one and see what makes the code doesn't compile, but there are some apis that aren't used explicit, like vectordrawable:vectordrawable that is supposed to be used internally by android

implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.preference:preference:1.0.0'
implementation 'androidx.browser:browser:1.0.0'
implementation 'androidx.vectordrawable:vectordrawable:1.0.1'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.percentlayout:percentlayout:1.0.0'
implementation 'androidx.annotation:annotation:1.1.0'
implementation 'androidx.media:media:1.0.1'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'

Get the list of dependencies and details about each dependency using following commands.

gradlew -q app:dependencies

gradlew -q app:dependencyInsight --configuration FLAVORNAMEReleaseCompileClasspath --dependency dependencyNAME

gradlew -q app:dependencyInsight --configuration RanjanReleaseCompileClasspath --dependency com.google.android.libraries.tv:companionlibrary

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM