My company has an android library (an SDK) which we distribute to third parties. It uses some features of the Android Support libraries - specifically (but not limited to) android.support.annotation
and android.support.v4.content.LocalBroadcastManager
The problem is, if we compile our library against (say) com.android.support:appcompat-v7:27.1.1
and the third party compiles against (say) com.android.support:appcompat-v7:28.0.0
then the third party app receives the All com.android.support libraries must use the exact same version specification warning.
If we were developing a single self-contained app, then the fix is clear; just update everything to use the latest (28) version of the support libraries. Same deal if we were to move to androidX
.
However, for a redistributable library which may be out of date (a third party could use our SDK 18 months after it's release) we can't do this.
As far as I can see, there is no guidance on what to do here. Options I can think of:
Do nothing. The third parties can ignore the warning. This is what we've been doing in the past and it does seem to be fine, however I don't like the idea of shipping something which is going to throw warnings at our customers.
Remove all references to
com.android.support
from our SDK. This is very painful, becauseLocalBroadcastmanager
only exists in the support libraries, it's not part of Android itself, and also we use@NonNull
and@Nullable
extensively. They are great at preventing bugs, and important for Kotlin support and I wouldn't like to lose them.Remove all references to
com.android.support
from our SDK but make an exemption forcom.android.support:support-annotations
for@Nullable
. Perhaps that will make the warnings go away? LosingLocalBroadcastManager
would not be great though. Is this even OK?Always ship our SDK compiled against the latest support libraries and aggressively push third parties to update as well. Pushing third parties like this doesn't feel good, and also it means if we don't have a release for say 9-months we'll have to make interim releases just to keep up with Android support library updates.
Ship different versions in parallel of our SDK compiled against different support libraries, where the third party can pick the one they want. This is a lot of work (how many versions back do we go?) and would be quite confusing I imagine.
Give up and support iOS only (lol)
Anyway - As mentioned I've been unable to find any guidance on how to handle this kind of thing. Any feedback would be much appreciated