Bird
Raised Fist0
Fluttermobile~20 mins

Android build configuration in Flutter - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Android Build Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ ui_behavior
intermediate
2:00remaining
Understanding Android build flavors in Flutter
You have two build flavors: dev and prod. Which command builds the dev flavor APK?
Aflutter build apk --flavor prod
Bflutter build apk --flavor dev
Cflutter run --flavor prod
Dflutter run --flavor dev
Attempts:
2 left
💡 Hint
Use the build command with the flavor name to create the APK.
🧠 Conceptual
intermediate
2:00remaining
Purpose of build.gradle in Android Flutter projects
What is the main role of the build.gradle file inside the Android folder of a Flutter project?
AIt defines Android build settings like SDK versions, dependencies, and signing configs.
BIt contains Flutter Dart code for UI components.
CIt manages iOS build configurations.
DIt stores Flutter package dependencies.
Attempts:
2 left
💡 Hint
Think about what controls Android-specific build details.
📝 Syntax
advanced
2:30remaining
Correct syntax for signing config in build.gradle
Which option correctly defines a signing config named release in the Android build.gradle file?
A
signingConfigs {
    release {
        storeFile = file('keystore.jks')
        storePassword = 'password'
        keyAlias = 'key'
        keyPassword = 'password'
    }
}
B
signingConfigs {
    release: {
        storeFile = 'keystore.jks'
        storePassword = 'password'
        keyAlias = 'key'
        keyPassword = 'password'
    }
}
C
signingConfigs {
    release {
        storeFile 'keystore.jks'
        storePassword 'password'
        keyAlias 'key'
        keyPassword 'password'
    }
}
D
signingConfigs {
    release {
        storeFile file('keystore.jks')
        storePassword 'password'
        keyAlias 'key'
        keyPassword 'password'
    }
}
Attempts:
2 left
💡 Hint
In Gradle Groovy DSL (used in Flutter), properties in signingConfigs blocks use no '=' and file() for paths.
❓ lifecycle
advanced
2:00remaining
Effect of changing minSdkVersion in build.gradle
If you increase minSdkVersion in your Android build.gradle file, what is the likely effect?
AThe app will not run on devices with Android versions below the new minSdkVersion.
BThe app will support more devices.
CThe app size will automatically decrease.
DThe app will run faster on all devices.
Attempts:
2 left
💡 Hint
minSdkVersion sets the lowest Android version supported.
🔧 Debug
expert
3:00remaining
Diagnosing build failure due to missing keystore file
You get this error when building a release APK: FileNotFoundException: keystore.jks (No such file or directory). What is the most likely cause?
AThe AndroidManifest.xml file is missing required permissions.
BThe Flutter SDK is outdated and needs updating.
CThe keystore file path in build.gradle is incorrect or the file is missing.
DThe Dart code has syntax errors.
Attempts:
2 left
💡 Hint
Check the file path and existence of the keystore file.

Practice

(1/5)
1. What file do you edit to change the Android app ID in a Flutter project?
easy
A. android/gradle.properties
B. lib/main.dart
C. android/app/build.gradle
D. pubspec.yaml

Solution

  1. Step 1: Identify where Android app settings are configured

    The Android app ID is set in the Gradle build configuration files.
  2. Step 2: Locate the specific file for app-level settings

    The file android/app/build.gradle contains the app ID under the defaultConfig section.
  3. Final Answer:

    android/app/build.gradle -> Option C
  4. Quick Check:

    App ID set in build.gradle [OK]
Hint: App ID is in app-level build.gradle file [OK]
Common Mistakes:
  • Editing pubspec.yaml instead of build.gradle
  • Changing main.dart which is for Dart code
  • Modifying gradle.properties which is for Gradle settings
2. Which syntax correctly sets the minimum SDK version in android/app/build.gradle?
easy
A. minSdkVersion -> 21
B. minSdkVersion = 21
C. minSdkVersion: 21
D. minSdkVersion 21

Solution

  1. Step 1: Understand Gradle syntax for SDK versions

    Gradle uses simple assignment without equals or arrows for SDK versions.
  2. Step 2: Identify correct syntax

    The correct syntax is minSdkVersion 21 without equals or colon.
  3. Final Answer:

    minSdkVersion 21 -> Option D
  4. Quick Check:

    Gradle uses space, not = or : [OK]
Hint: Use space, not equals, for SDK versions in Gradle [OK]
Common Mistakes:
  • Using equals sign (=) which causes syntax error
  • Using colon (:) which is invalid in Gradle
  • Using arrow (->) which is not Gradle syntax
3. Given this snippet in android/app/build.gradle:
defaultConfig {
    applicationId "com.example.app"
    minSdkVersion 19
    targetSdkVersion 33
    versionCode 5
    versionName "1.0.4"
}
What is the app version name that will appear to users?
medium
A. "1.0.4"
B. "1.0.5"
C. "5"
D. "33"

Solution

  1. Step 1: Identify versionName in the configuration

    The versionName is set to "1.0.4" which is the user-visible version.
  2. Step 2: Differentiate versionCode and versionName

    versionCode is an internal number (5), not shown to users.
  3. Final Answer:

    "1.0.4" -> Option A
  4. Quick Check:

    versionName is user-visible version [OK]
Hint: versionName shows app version to users [OK]
Common Mistakes:
  • Confusing versionCode with versionName
  • Using targetSdkVersion as version
  • Ignoring quotes around versionName
4. You added minSdkVersion 21 in android/app/build.gradle but get a build error. What is the likely cause?
medium
A. You forgot to update compileSdkVersion to at least 21
B. minSdkVersion must be less than 21
C. You need to add quotes around 21
D. minSdkVersion is set in pubspec.yaml, not build.gradle

Solution

  1. Step 1: Understand SDK version dependencies

    The compileSdkVersion must be equal or higher than minSdkVersion.
  2. Step 2: Check build.gradle for compileSdkVersion

    If compileSdkVersion is lower than 21, build fails when minSdkVersion is 21.
  3. Final Answer:

    You forgot to update compileSdkVersion to at least 21 -> Option A
  4. Quick Check:

    compileSdkVersion ≥ minSdkVersion [OK]
Hint: compileSdkVersion must be ≥ minSdkVersion [OK]
Common Mistakes:
  • Thinking minSdkVersion must be less than 21
  • Adding quotes around numeric SDK versions
  • Trying to set minSdkVersion in pubspec.yaml
5. You want to create a new build type called staging in android/app/build.gradle that behaves like debug but with a different app ID suffix. Which snippet correctly adds this?
hard
A. buildTypes { staging { extends debug applicationIdSuffix ".staging" } }
B. buildTypes { staging { initWith debug applicationIdSuffix ".staging" } }
C. buildTypes { staging { copyFrom debug applicationIdSuffix ".staging" } }
D. buildTypes { staging { inherit debug applicationIdSuffix ".staging" } }

Solution

  1. Step 1: Recall Gradle syntax for copying build types

    Gradle uses initWith to copy settings from another build type.
  2. Step 2: Verify correct method and syntax

    initWith debug correctly copies debug settings; applicationIdSuffix ".staging" adds suffix.
  3. Final Answer:

    buildTypes { staging { initWith debug applicationIdSuffix ".staging" } } -> Option B
  4. Quick Check:

    Use initWith to copy build type [OK]
Hint: Use initWith to clone build types in Gradle [OK]
Common Mistakes:
  • Using extends or inherit which are invalid Gradle keywords
  • Trying copyFrom which does not exist
  • Not adding applicationIdSuffix properly
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard