Customizing the build
There are a lot of ways to customize the build process, and when you are editing the build files in Android Studio, it is recommended to always sync the project with the Gradle files, no matter what you are customizing. This becomes especially important when you start adding dependencies or BuildConfig
fields, which we will talk about soon.
Android Studio will show a message in the editor as soon as you edit settings.gradle
or build.gradle
, and it is possible to trigger the sync at all times by navigating to Tools | Android | Sync Project with Gradle Files or the corresponding button in the toolbar.
Under the hood, the Android Studio Sync actually runs the generateDebugSources
task to generate all the necessary classes, based on the configuration in the build files.
Manipulating manifest entries
We already saw that it is possible to configure applicationId
, minSdkVersion
, targetSdkVersion
, versionCode
, and versionName
directly from the build files, instead of in the manifest...