information such as dependencies, plugins, etc. With the Android plugin, you can define additional properties for your application, such as package name, version code, etc. Project ├── app │ ├── build.gradle │ ├── keystore │ ├── libs │ │ └── *.jar │ └── src └── build.gradle
all jars in this folder. Use this for dependencies not available via published repositories. ! compile fileTree(dir: 'libs', include: '*.jar') . ├── app │ ├── build.gradle │ ├── keystore │ ├── libs │ │ └── *.jar │ └── src └── build.gradle
└── AndroidManifest.xml │ ├── instrumentTest │ │ ├── AndroidManifest.xml │ │ └── java │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ └── res │ └── release │ ├── AndroidManifest.xml │ └── res │ └── values │ └── analytics.xml The Android plugin gives you release and debug configurations for free. Simply create a source folder for each configuration and get started with basic build customization.
• Defines package name • Defines version code and version name • Adds version name to BuildConfig (access it with BuildConfig.VERSION_MAJOR, no need for a Context!). Next version of the build tools will have more information out of the box, such as package name, version name, version code, etc.
the package name for debug build types • Adds a suffix to the version name for debug build types • Configures release build types to use a signing configuration that is shown in the next slide
from the main source set • The manifest is merged into the app manifest • The code acts as just another source folder • The resources are overlayed over the main resources, replacing existing values
but not in release mode • Custom implementation for debugging • Different resources for debug mode (for instance when a resource value is tied to the signing certificate)
This creates a custom build type named ‘beta’, initializing it from the properties of the release build type. By default, it would have it’s source set under ‘src/beta’. Here I manually set the source set to be under ‘src/ release’. The only difference between the two versions in my case is that beta has a suffix in it’s version name.
‘keystore’. It asks for a password for both via the command line. Alternatively, you can make it pick up system properties, or pick them up in a file like signing.properties