Feb 11 | 7:25 PM |
Mark M. | has entered the room |
Feb 11 | 7:25 PM |
Mark M. | turned on guest access |
Scott W. | has entered the room |
Scott W. |
Howdy
|
Mark M. |
hello, Scott!
|
Mark M. |
how can I help you today?
|
tekconsult@dataeffects.com | has entered the room |
tekconsult@dataeffects.com | has left the room |
Scott W. |
I am about to have to start distributing an Android library, and I'm completely in the dark about that process.
|
Mark M. |
distributing to whom? a team? the general public?
|
Feb 11 | 7:30 PM |
Scott W. |
one of my company's customers at first, but other customers will want it eventually.
|
tekconsult@dataeffects.com | has entered the room |
Mark M. |
but, not to arbitrary developers? IOW, you want to limit access just to those customers?
|
Mark M. |
(BTW, hello tekconsult! I will be with you shortly!)
|
Scott W. |
I'm not sure how important it is for it to be private. I think that's the direction we want to go, but even if someone else got a hold of it they wouldn't be able to use it without an auth token.
|
Mark M. |
it will be substantially simpler if you were to make the library publicly available -- then, you could arrange to host it on Maven Central, for example
|
Mark M. |
and there is quite a bit written about that, particularly within the last couple of weeks
|
Scott W. |
what happened recently?
|
Mark M. |
if you look at your project's top-level build.gradle file, you will probably see references to an artifact repository called JCenter (represented by the jcenter() call in a repositories closure in Gradle)
|
Mark M. |
JCenter is being shut down
|
Scott W. |
oh boy
|
Mark M. |
it will not accept updates or new artifacts shortly and will then be read-only for several months before going "poof"
|
Mark M. |
so, developers who published libraries to JCenter are working on finding new homes
|
Mark M. |
for many, that will be Maven Central
|
Feb 11 | 7:35 PM |
Mark M. |
if you decide that you do not want to make it publicly available, a Maven-style artifact repository is still the simplest approach from your customer's standpoint, in terms of integrating into their own projects
|
Mark M. |
in the end, a Maven-style artifact repository is really just a directory tree with some metadata and your library
|
Mark M. |
so, for example, I published my CWAC libraries using Amazon S3
|
Mark M. |
however, dealing with security for a private repository is going to be somewhat more annoying, enough that your firm might consider a commercial repository system
|
Mark M. |
Sonatype's Nexus or Artifactory are two that I know of
|
Mark M. |
I have not used either
|
Scott W. |
so if we just host all our libraries on an S3 bucket, our customer could have a one-line implementation dependency in their build.gradle?
|
Mark M. |
it would only be one line if the S3 bucket were publicly visible and you were relying on "security by obscurity"
|
Scott W. |
ok can you point me to information on that process?
|
Scott W. | |
Mark M. |
I can do some poking around and will try to get you something before the end of the chat -- I don't have any links handy
|
Scott W. |
I'm looking at this now
|
Scott W. |
ok. I'll do some reading for a few minutes
|
Feb 11 | 7:40 PM |
Mark M. |
based on a quick skim, other than it being from 2017, it's probably not bad
|
Mark M. |
let me take a question from tekconsult, and I'll come back to you in a bit
|
Mark M. |
tekconsult: hi! how can I help you today?
|
tekconsult@dataeffects.com |
View paste
|
Mark M. |
I agree with the notion of a single timer, rather than one per row
|
Mark M. |
you could try saying that on each timer tick that you update your model data and call submitList() on your ListAdapter to update the countdown text, but I do not know how well that would work
|
Mark M. |
at a lower level, you could ask the RecyclerView for the visible rows, iterate over them, and just update each countdown text
|
Mark M. |
that would be faster than the submitList() option, but you would have to test your logic to make sure that scrolling is OK
|
Mark M. |
and, frankly, for 10-20 items, I would lean towards dumping the RecyclerView entirely
|
Mark M. |
just put the 10-20 items in a LinearLayout or ConstraintLayout and wrap it in a NestedScrollView
|
Mark M. |
that will be *much* simpler to update deterministically
|
Feb 11 | 7:45 PM |
tekconsult@dataeffects.com |
View paste
|
Mark M. |
"But still only have one timer and iterate over the views that I would build dynamically in the Layout (on the push notification)? " -- yes
|
Mark M. |
"And how would I find visible rows if I keep the recycler?" -- there are methods for it on RecyclerView
|
tekconsult@dataeffects.com |
Thank you for the ideas to try.
|
tekconsult@dataeffects.com | has left the room |
Mark M. |
Scott: back to you!
|
Mark M. |
https://notificare.com/blog/2020/07/10/Share-Yo... covers some of this and is newer
|
Mark M. |
https://proandroiddev.com/creating-a-private-ma... covers the same basic topics, but using GitLab rather than Amazon S3 as the host
|
Mark M. |
https://dev.to/narayanansampath/publish-android... is really new but is pretty thin and looks like it just repeats what was in the post you were looking at
|
Feb 11 | 7:50 PM |
Scott W. |
ok I've some questions about how this all works still
|
Scott W. |
in the first example, he adds his S3 bucket as a maven repo
|
Scott W. |
is that a correct description of what's happening?
|
Mark M. |
if you mean in the "Using Your New Dependency" section, yes
|
Scott W. |
ok
|
Scott W. |
and what exactly makes it a Maven repository? Is it the pom.xml?
|
Mark M. |
that supplies metadata about your library
|
Mark M. |
which is a key part of the repository entry for that library
|
Mark M. |
there is also a specific directory structure that a repository will follow, based on your artifact group ID and artifact name
|
Mark M. |
for my own repo, I have my own scripts to sync with S3, because my work there pre-dated any of these newer recipes
|
Mark M. |
but plugins like maven-publish will set up that directory structure for you (AFAIK)
|
Scott W. | |
Scott W. |
this is one of our dependencies.
|
Scott W. |
com.opentok.android:opentok-android-sdk that's the actual line in build.gradle.
|
Mark M. |
right
|
Mark M. |
the POM will contain information about that dependency
|
Feb 11 | 7:55 PM |
Mark M. |
so when your customers have an implementation line for your library in their dependencies {}, they will pull in tokbox automatically
|
Scott W. |
can I view the tokbox pom?
|
Mark M. | |
Mark M. |
that link is for 2.18.1 for that library
|
Mark M. |
and shows the four files for that version that Bintray is serving: the AAR, the POM, and MD5 hashes for each
|
Mark M. |
if you click the link for the POM, it should prompt you to download it
|
Scott W. |
ok I see that
|
Mark M. |
usually, POMs are generated by a Gradle plugin
|
Mark M. |
though there is nothing stopping you from hand-maintaining that XML, if you really like angle brackets :-)
|
Scott W. |
plugin good
|
Scott W. |
so, the pom is a lot smaller than I though tit would be.
|
Scott W. |
it just shows 1 dependency of androidx.annotation
|
Feb 11 | 8:00 PM |
Mark M. |
right, they are fairly self-contained, apparently
|
Scott W. |
ok so for my sdk
|
Scott W. |
we have 7 modules
|
Scott W. |
but the app should only depend on 1 of those modules
|
Mark M. |
that 1 module pulls in the other 6?
|
Scott W. |
yeah
|
Mark M. |
OK, all 7 will go into your repository, but from a documentation standpoint, you would be telling your customers only about the 1
|
Scott W. |
so they would have a dependency like com.me.theone:1.0.0
|
Scott W. |
and that would have a pom file that declares the other 6?
|
Mark M. |
yes
|
Mark M. |
plus any other dependencies it might have (e.g., on Jetpack libraries), if any
|
Scott W. |
oh yeah there are tons of libraries to include
|
Scott W. |
actually
|
Scott W. |
I've got all these androidx libraries declared in all 7 modules.
|
Scott W. |
eh. I don't want to open that can right now actually.
|
Scott W. |
ok so I've got this pom file generated by a pluggin
|
Scott W. |
it's hosted on our S3 bucket along with aars for all of my modules?
|
Feb 11 | 8:05 PM |
Mark M. |
if you have 7 modules to publish, you will have 7 AARs and 7 POMs
|
Scott W. |
ok
|
Scott W. |
how long would you expect a competent person to set this up?
|
Mark M. |
I haven't used modern recipes from scratch
|
Mark M. |
so I'm not really a good judge of that
|
Scott W. |
ok
|
Mark M. |
what I would consider doing is setting up a scrap library and scrap project and experimenting with the basics
|
Scott W. |
what would change if we did this the public maven way?
|
Mark M. |
other than Amazon S3, you would choose your public Maven repository (Maven Central) and follow their instructions
|
Mark M. |
from your customers' standpoint, one advantage of Maven Central is that they do not need to do anything special to use your library, beyond add the one implementation line
|
Mark M. |
as they either presently have or will soon have the mavenCentral() line already set up in their top-level build.gradle
|
Mark M. |
rather than having to paste in that S3 block and deal with passwords, etc.
|
Scott W. |
right
|
Feb 11 | 8:10 PM |
Mark M. |
in the end, you will still have 7 AARs and 7 POMs
|
Scott W. |
what is Bintray?
|
Mark M. |
it's merely a matter of where they reside and how customers get to them
|
Mark M. |
effectively, it's a superset of JCenter, as I understand it
|
Scott W. |
shoot I think you're right
|
Scott W. |
it's going away too
|
Mark M. |
and, as you can see by that "Deprecation Notice" banner at the top of those tokbox pages, it too is going away
|
Mark M. |
right
|
Scott W. |
ok where is maven central?
|
Scott W. | |
Mark M. |
that's a third-party site
|
Mark M. |
the official search site is https://search.maven.org/
|
Mark M. |
it's managed by Sonatype, just as JCenter/Bintray are managed by JFrog
|
Mark M. |
JFrog is just electing to dump the public service and focus on their commercial offerings
|
Scott W. |
ok I'd like to switch gears for the last part of this
|
Scott W. |
a little switch
|
Feb 11 | 8:15 PM |
Scott W. |
let's say tomorrow rolls around and I'm struggling with this maven stuff but my boss is all "you better get me a solution by 5pm!"
|
Scott W. |
hypothetically
|
Mark M. |
I *love* hypothetical bosses! :-)
|
Scott W. |
I could just send this company the 7 AARs and the list of dependencies that those AARs need and tell them to include it all in their dependencies right?
|
Mark M. |
they could drop the AARs into some directory (e.g., libs/) and include them that way
|
Mark M. |
they would not get the transitive dependencies, though, so you would have to document that as well
|
Mark M. |
and then shipping them updates is a pain, and keeping the versions in sync is a pain, and...
|
Mark M. |
now, big companies go this route -- the Apple Music SDK is distributed that way, for example
|
Mark M. |
so it's not completely insane, but unless you need this by tomorrow 5pm, I'd aim for using an artifact repository
|
Scott W. |
yeah
|
Mark M. |
but, it might be you manually distribute the AARs as a stopgap and migrate that one customer to the repository solution when it is ready
|
Scott W. |
right, I think boss will like that idea. Unless I can figure out the maven stuff real quick.
|
Scott W. |
what are the costs to using maven central?
|
Mark M. |
free AFAIK
|
Mark M. |
it's basically marketing for their commercial products/services
|
Scott W. |
how do I tell which of my dependencies are transitive?
|
Feb 11 | 8:20 PM |
Mark M. |
if we think of your 1 root library... everything in dependencies {} in that module's build.gradle is a transitive dependency for whoever tries using that library
|
Scott W. |
ko
|
Mark M. |
the plugin that generates your POM will set up the dependency entries for you
|
Scott W. |
will I still be able to use my sdk as submodules like normal for my own app?
|
Mark M. |
yes, though I warn you that at some point you're going to want to start "dogfooding" that SDK, to make sure it works as you expect as you publish updates
|
Scott W. |
hmm
|
Mark M. |
that could be in the form of a demo app that your customers use to learn how to use your SDK
|
Scott W. |
yeah I've got a demo app
|
Scott W. |
and our own app on top of it all
|
Scott W. |
our own app uses the sdk differently than the demo app and our customers though
|
Scott W. |
and no one really tests the demo app.
|
Mark M. |
guess what! you're probably going to need to start testing the demo app :-)
|
Scott W. |
yup
|
Mark M. |
basically, if this is going to customers, your SDK is part of your product now, and you will need to treat it as such
|
Mark M. |
documentation, testing, demo apps, support, etc.
|
Scott W. |
yeah I agree.
|
Feb 11 | 8:25 PM |
Mark M. |
hopefully, so does your hypothetical boss
|
Scott W. |
it's all about where do we spend our resources right now
|
Scott W. |
last question:
|
Scott W. |
I've been trying to convince my company to hire someone that really knows their stuff with Android development.
|
Scott W. |
they keep bringing on "senior developers" from contracting companies that aren't cutting it.
|
Scott W. |
I've ended up teaching these guys.
|
Scott W. |
Do you have any advice on how to quickly figure out the... level of Android development someone is at?
|
Mark M. |
not really, insofar as I don't interview developers much, and I am assuming that you are asking for something along those lines
|
Scott W. |
yeah
|
Mark M. |
live coding in an interview seems to be gaining steam -- that has pros and cons but it definitely gets to the crux of your concern
|
Scott W. |
ok I'll try this on the next guy.
|
Scott W. |
All right. Thank you so much for your time!
|
Mark M. |
happy to help!
|
Scott W. |
we packed a lot in.
|
Scott W. |
Have a good night!
|
Mark M. |
the transcript will be up on https://commonsware.com/office-hours/ shortly
|
Mark M. |
and, have a pleasant evening!
|
Feb 11 | 8:30 PM |
Scott W. | has left the room |
Mark M. | turned off guest access |