I just created a new library, Powerful Image View .
My library is a custom AppCompatImageView, so I need the appcompat-v7 library. And here comes the question:
How should I add it to my library?
Should I use 'compile', or 'provided' and let the user add the library to its own dependencies?
And how should i handle different versions of the libraries used, since i'm not depending on a specific version?
I added to the library's gradle file this line:
provided 'com.android.support:appcompat-v7:+'
I'd like to know your thoughts about this :)
Should I use 'compile', or 'provided' and let the user add the library to its own dependencies?
I would use compile
and make sure that the developer using your library understands that your library relies upon appcompat-v7
, as that in turn places lots of other requirements (eg, using AppCompatActivity
, using Theme.AppCompat
).
And how should i handle different versions of the libraries used, since i'm not depending on a specific version?
Well, you are requiring some version. AppCompatImageView
does not exist in all versions of appcompat-v7
. I recommend depending upon a concrete version (ie, not +
), ideally the latest-and-greatest version.
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.