I am building a Android library which contains some add-on features on top of support library, adding support library increases the library size, how can I ask the developer using my library to add the support library explicitly or use the one if the developer has already added it. I don't want to package the support library in my own distribution.
Asked
Active
Viewed 29 times
0
-
2You can't add libraries at runtime – an_droid_dev Aug 29 '17 at 14:02
-
what if some days later , user updated to new version and something deprecated but you lib still wants to use deprecated version and user don't want – Pavneet_Singh Aug 29 '17 at 14:05
-
That is difficult to answer in the abstract. You can use `provided` instead of `compile` in your `build.gradle` file to say that you want to compile against some support libraries but not make those libraries be mandatory dependencies. You would need to use something like `Class.forName()` to look up whether a given library-supplied class exists at runtime before attempting to use anything from the library. – CommonsWare Aug 29 '17 at 14:21
-
The support library will be provided, that won't be an issue, will the `provided` keyword not package the support library if distributed via jitpack.io? – Gurleen Sethi Aug 29 '17 at 14:24