1

I have an android studio project where I recently changed the minSDK from 21 to 26. Now I saw that the project has a new dependecy 'androidx.legacy:legacy-support-v4:1.0.0' and I really don't know how it came here.

I never added that dependency to my project and now I don't know if I can safely delete it.

Is there a possibility that android studio added that dependency because of that minSDK change?

if not is there a way to see if the project needs that dependency.

Hussien Fahmy
  • 1,119
  • 6
  • 24
canan
  • 51
  • 4
  • 3
    Run a Gradle dependency report and see what is pulling in that dependency. – CommonsWare Dec 27 '21 at 12:34
  • thank you. I didn't know that there is that functionality. Can I do this in android studio? – canan Dec 27 '21 at 12:38
  • 1
    https://stackoverflow.com/a/39020703/4168607 – ADM Dec 27 '21 at 12:40
  • thank you . How do I know if its really used? The library is listed 9 times in that dependecy tree but I don't understand what uses that library and how it was listed in the build.gradle file. I didn't add that – canan Dec 27 '21 at 12:43
  • 1
    Since the dependency is in your `build.gradle` If its being in your code then by removing it you should get a compile time error. – ADM Dec 27 '21 at 12:45
  • I removed it and the app could still be build without any problems. So its save to delete? Is there a way that that dependecy was added by android studio? – canan Dec 27 '21 at 12:47
  • @canan, if application is build/compiled it doesn't mean it will work on all devices. Theoretically you should build the application and the run it on all the android versions that you want to support. Or at least on the minimum version. More details about support library can be found here https://developer.android.com/topic/libraries/support-library – Marcel Preda Jan 06 '22 at 08:57

0 Answers0