Mark M. | has entered the room |
Mark M. | turned on guest access |
Jan 28 | 7:30 PM |
Ken | has entered the room |
Mark M. |
hello, Ken!
|
Mark M. |
how can I help you today?
|
Ken |
View paste
(1 more line)
|
Mark M. |
what you're seeing is two different forms of creating a project
|
Mark M. |
a typical Android Studio project puts the application code in an app/ module
|
Mark M. |
in that case, there are two build.gradle files: one in the project root, and one in app/
|
Mark M. |
the stuff that you cite appears in the build.gradle that is in the project root
|
Mark M. |
now, it is entirely possible to not bother with an app/ module, particularly if your project is fairly simple
|
Mark M. |
in that case, there would just be one build.gradle file, containing the stuff you cite, plus the stuff that ordinarily would appear in the app/ module's build.gradle file
|
Ken |
Oh, I see -- so the app file doesn't need to specify that, because it is getting that information from the parent (in some sense)? That's cool.
|
Mark M. |
yes
|
Mark M. |
the top-level build.gradle file contains stuff that applies for all of the modules in the project
|
Jan 28 | 7:35 PM |
Mark M. |
whereas app/build.gradle contains stuff specific to the app/ module
|
Jan 28 | 7:35 PM |
Ken |
Oh, that's great -- I rarely look at the Gradle file in the parent folder so I missed some of this...
|
Ken |
Mind if I ask another question or two since it's just us at the moment?
|
Mark M. |
go right ahead
|
Ken |
View paste
|
Ken |
What's the difference between these and for Build-tools, should we always use the most current version available?
|
Mark M. |
these correspond to the tools/, platform-tools/, and build-tools/ directories of your Android SDK installation
|
Mark M. |
platform-tools/ generally contains binaries that are platform-specific, such as adb
|
Mark M. |
tools/ generally contains stuff that is cross-platform, because it's implemented in Java, like monkeyrunner, draw9patch, etc.
|
Mark M. |
build-tools/ contains the command-line tools used for actually building the app: aapt, dx, etc.
|
Mark M. |
the biggest filesystem difference is that, as you note, you can have multiple build-tools/ installed
|
Jan 28 | 7:40 PM |
Mark M. |
those correspond to the buildToolsVersion value in app/build.gradle
|
Mark M. |
the reason for having N of those is for historical builds, such as checking out a tag from two years ago and trying to build it agani
|
Mark M. |
er, again
|
Mark M. |
the vision is that all the tools are versioned: Gradle, Android Plugin for Gradle, and buildToolsVersion
|
Mark M. |
so that when you check out that tagged set of code, it has in it all the information about how to build the project, including the right versions of all the tools
|
Mark M. |
as it is possible that the stuff you did two years ago would require tweaking if built with today's tools
|
Ken |
I thought it might be something like that -- just seemed strange that we version built-tools but no so much platform-tools and tools...
|
Mark M. |
well, you shouldn't need monkeyrunner from two years ago
|
Mark M. |
or adb
|
Mark M. |
or draw9patch
|
Mark M. |
etc.
|
Ken |
Ah, I see -- so we version what we need to -- smart.
|
Mark M. |
basically, the difference is in tools for building the project versus general development tools
|
Mark M. |
but, yes, it's confusing to look at
|
Mark M. |
I remember the good old days, when we just had tools/ and were happy for it... :-)
|
Ken |
Ha!
|
Jan 28 | 7:45 PM |
Ken |
My last version related question is about dependencies and version numbers like: compile 'com.android.support:support-v13:23.1.1' -- that seems to have two separate version numbers baked into it -- the "v13" and the "23.1.1" -- what's the difference between these two parts and how would we know what the latest version of an available library is? (I could go on using 23.1.1 in my script forever if I didn't update it, right?)
|
Mark M. |
-v13 refers to the minSdkVersion of relevance for the library
|
Mark M. |
so, appcompat-v7 works back to API Level 7
|
Mark M. |
support-v13 contains classes that are relevant for API Level 13+, though it has a transitive dependency on support-v4, which contains classes that are relevant for API Level 4+
|
Mark M. |
the 23.1.1 is the actual version of the library itself, following standard semantic versioning format
|
Mark M. |
they are dumping the -v7 nomenclature for newer libraries, as you don't see that on design, customtabs, percent, etc.
|
Jan 28 | 7:50 PM |
Ken |
Is there a place that lists the latest versions of these (appcompat, support, etc.) libraries?
|
Mark M. |
your hard drive :-)
|
Mark M. |
$ANDROID_SDK/extras/android/m2repository
|
Mark M. |
where $ANDROID_SDK is wherever you installed the Android SDK
|
Jan 28 | 7:55 PM |
Mark M. |
you'll see all of the artifacts and their versions inside of there
|
Mark M. |
that's a local Maven-style artifact repository, what you get from the Android Repository entry in the SDK Manager
|
Ken |
Ah, I see -- and if there's a newer version available, the SDK Manager will offer to update to it...
|
Mark M. |
right
|
Mark M. |
which downloads new files into that directory tree
|
Ken |
It's a bit confusing as the SDK manager just says "Android Support Library" but I'm thinking that may include several of the dependencies I see in a build.gradle file...
|
Mark M. |
there is "Android Support Library" and "Android Repository"
|
Mark M. |
the former is for Eclipse/Ant
|
Mark M. |
or other environments that cannot use AAR files in a Maven-style repository
|
Jan 28 | 8:00 PM |
Ken |
Oh, that's interesting -- confusing too though as I see the Android Support Repository has Rev 25, yet there's all kinds of libraries underneath the m2repository folder with different versions. Must be an overall version number?
|
Mark M. |
yeah, something like that
|
Mark M. |
I don't tend to pay attention to the specific Rev number for that in the SDK Manager
|
Mark M. |
I just update it when a new version is available, and call it good
|
Jan 28 | 8:05 PM |
Ken |
Ok, sounds good -- thanks for all your help, Mark -- more people should take advantage of the fantastic resource you provide!
|
Mark M. |
feel free to tell them that :-)
|
Ken |
Will do. Have a great evening and thanks again.
|
Ken | has left the room |
Jan 28 | 8:25 PM |
Mark M. | turned off guest access |