

versionNameĪ string representing the release version of your app, shown to users. Apps normally use this during the upgrade process. versionCodeĪn integer representing this version of your app relative to others. Android Studio will issue a warning if this is anything other than the latest version, but you’re free to use any version you like. The version of Android intended for this application. Devices earlier than this will not see this application when accessing the Google Play store. The minimum Android SDK version supported by this application.

Prior to the move to Gradle, this was the package attribute of the root element of the Android Manifest. This value can never change during the life of your app changing it will result in your app being treated as a brand new application, and existing users will not see changes as an update. The “package” name of the application, which must be unique in the Google Play store. The defaultConfig block inside android shows several properties: applicationId Both of these values should be assigned to the most recent available version, as they are backward compatible and include all current bug fixes. Here you must specify the compilation target using compileSdkVersion and the build tools version via buildToolsVersion. The android block is the entry point for the Android DSL. The support library is listed as a compile dependency, so all of its classes are available throughout the project.ĭo not apply the Java plug-in. Note that the -v7 means support for Android applications back to version 7 of Android, not version 7 of the support library itself. The third line tells Gradle to add version 23.3.0 of the appcompat-v7 jar files from the Android Support Libraries. The second line tells Gradle to download version 4.12 of JUnit and add it to the “test compile” phase, meaning that JUnit classes will be available in the src/androidTest/java source tree, as well as the (optional) src/test/java tree, which can be added for pure unit tests (i.e., those that do not involve the Android API). jar in the libs folder are added to the compile classpath.

The first, fileTree dependency, means that all files ending in. The dependencies block consists of three lines. This section is discussed in detail in Recipe 1.2. The apply functionality in Gradle adds the Android plug-in to the build system, which enables the android section Domain Specific Language (DSL) configuration.

Top-level adle file // Top-level build file where you can add configuration options // common to all subprojects/modules.
