AAD Android Build System, Gradle & App Deployment 1 — Questions and Answers
Question 1: What is the primary build tool used in Android development with Android Studio?
- Apache Maven
- Apache Ant
- Gradle (Correct answer)
- Make
Correct answer: Gradle
Gradle is the official build system for Android, integrated into Android Studio and used for dependency management, compilation, and packaging.
Question 2: In an Android Gradle project, what does `compileSdkVersion` specify?
- The minimum Android API level the app can run on
- The Android API level used to compile the app source code (Correct answer)
- The Android version targeted for runtime optimization
- The API level used for running instrumented tests
Correct answer: The Android API level used to compile the app source code
`compileSdkVersion` defines the API level against which the app is compiled, giving access to the APIs available in that version without affecting runtime behavior.
Question 3: Which file contains the module-level Gradle build configuration including dependencies and build types?
- build.gradle (root)
- settings.gradle
- gradle.properties
- app/build.gradle (Correct answer)
Correct answer: app/build.gradle
The `app/build.gradle` file contains the module-specific configuration including dependencies, build types, and product flavors.
Question 4: What is the purpose of `versionCode` in an Android app?
- It is displayed to users on the Play Store as the app version string
- It is a string identifier used in Play Store release notes
- It is an internal integer used by the Play Store to determine if an update is newer (Correct answer)
- It specifies the minimum SDK version required to run the app
Correct answer: It is an internal integer used by the Play Store to determine if an update is newer
`versionCode` is an integer that must increase with each release; the Play Store uses it to determine update ordering, while `versionName` is the human-readable version shown to users.
Question 5: Which Gradle task produces a release-signed APK?
- buildRelease
- packageRelease
- assembleRelease (Correct answer)
- compileRelease
Correct answer: assembleRelease
The `assembleRelease` Gradle task compiles, packages, and signs the app with the release configuration, producing a release-ready APK.
Question 6: What is a 'build variant' in Android development?
- An alternative version of the app's XML layouts
- A combination of a build type and a product flavor (Correct answer)
- A different version of Kotlin used per module
- A variant of the manifest file for different screen sizes
Correct answer: A combination of a build type and a product flavor
A build variant is the combination of a build type (e.g., debug, release) and a product flavor (e.g., free, paid), allowing different versions of the app to be built from the same source.
Question 7: Where is the Gradle wrapper version for an Android project specified?
- build.gradle (root)
- gradle/wrapper/gradle-wrapper.properties (Correct answer)
- settings.gradle
- local.properties
Correct answer: gradle/wrapper/gradle-wrapper.properties
The `gradle/wrapper/gradle-wrapper.properties` file specifies the Gradle distribution URL, ensuring all team members and CI systems use the same Gradle version.
What is the primary build tool used in Android development with Android Studio?