The Android SDK is a set of tools and libraries that developers use to build Android apps. It includes things like the Android platform, emulator, and build tools.
Click to reveal answer
beginner
What does API level mean in Android development?
API level is a number that represents the version of the Android platform. It helps developers know which features and behaviors are available on a device.
Click to reveal answer
intermediate
Why is it important to set a minimum SDK version in your Android app?
Setting a minimum SDK version ensures your app only runs on devices that support the features you use. It prevents crashes on older devices.
Click to reveal answer
intermediate
What is the difference between compileSdkVersion and targetSdkVersion?
compileSdkVersion is the Android version you use to build your app. targetSdkVersion tells the system which Android version your app is designed for, affecting runtime behavior.
Click to reveal answer
intermediate
How can you check the API level of a device programmatically in Kotlin?
You can check the API level using: val apiLevel = android.os.Build.VERSION.SDK_INT. This returns the device's API level as an integer.
Click to reveal answer
What does the API level number represent in Android?
AThe number of apps installed
BThe version of the Android platform
CThe device screen size
DThe app's version code
✗ Incorrect
API level corresponds to the Android platform version, indicating available features.
Which SDK version should you set to ensure your app uses the latest Android features during build?
AcompileSdkVersion
BtargetSdkVersion
CminSdkVersion
DmaxSdkVersion
✗ Incorrect
compileSdkVersion defines the Android version used to compile your app.
If your app's minSdkVersion is 21, what does this mean?
AThe app supports all API levels
BThe app targets API level 21
CThe app only runs on devices with API level 21 or higher
DThe app compiles with API level 21
✗ Incorrect
minSdkVersion sets the lowest API level your app supports.
What happens if you run an app on a device with an API level lower than minSdkVersion?
AThe app crashes or won't install
BThe app runs normally
CThe app updates the device's API level
DThe app runs in compatibility mode
✗ Incorrect
Devices with API levels below minSdkVersion cannot install or run the app.
How do you get the current device API level in Kotlin?
Aandroid.device.apiLevel
BSystem.getApiLevel()
CBuild.VERSION_CODE
Dandroid.os.Build.VERSION.SDK_INT
✗ Incorrect
android.os.Build.VERSION.SDK_INT returns the device's API level.
Explain the roles of minSdkVersion, targetSdkVersion, and compileSdkVersion in Android app development.
Think about compatibility and build process.
You got /3 concepts.
Describe why understanding API levels is important when developing Android apps.
Consider how devices differ by Android version.
You got /3 concepts.
Practice
(1/5)
1. What does the minSdk version specify in an Android app?
easy
A. The latest Android version available
B. The Android version you compile your app against
C. The Android version your app is optimized for
D. The oldest Android version your app can run on
Solution
Step 1: Understand minSdk meaning
minSdk defines the minimum Android version that can run the app.
Step 2: Differentiate from other SDK versions
compileSdk is for building, targetSdk is optimization, but minSdk is the oldest supported version.
Final Answer:
The oldest Android version your app can run on -> Option D
Quick Check:
minSdk = oldest supported version [OK]
Hint: minSdk means minimum Android version supported [OK]
Common Mistakes:
Confusing minSdk with compileSdk
Thinking minSdk is the target optimization version
Assuming minSdk is the latest Android version
2. Which of the following is the correct way to set the compileSdk version to 33 in a Kotlin DSL Gradle file?
easy
A. compileSdkVersion 33
B. compileSdkVersion = 33
C. compileSdk = 33
D. compileSdk(33)
Solution
Step 1: Identify Kotlin DSL syntax for compileSdk
In Kotlin DSL, compileSdk is assigned directly with =.
Step 2: Compare options
compileSdkVersion 33 is Groovy syntax without assignment, compileSdkVersion = 33 uses the wrong property name, and compileSdk(33) is invalid function call syntax. Only compileSdk = 33 is correct.
Final Answer:
compileSdk = 33 -> Option C
Quick Check:
Kotlin DSL uses compileSdk = 33 [OK]
Hint: Kotlin DSL uses equals sign for assignments [OK]
B. minSdk is too high, app won't run on Android 21
C. targetSdk must be equal to minSdk
D. No problem, app runs on all versions
Solution
Step 1: Understand minSdk role
minSdk sets the lowest Android version the app supports.
Step 2: Check compatibility with Android 21
Since minSdk is 30, devices with Android 21 cannot run the app.
Final Answer:
minSdk is too high, app won't run on Android 21 -> Option B
Quick Check:
minSdk = 30 excludes Android 21 devices [OK]
Hint: minSdk must be ≤ lowest Android version supported [OK]
Common Mistakes:
Thinking compileSdk affects device compatibility
Assuming targetSdk limits device support
Believing app runs on all versions regardless of minSdk
5. You want to use a new Android feature introduced in API level 31 but still support devices running API level 21. How should you configure your Gradle file to safely use this feature?
hard
A. Set minSdk = 21, targetSdk = 31, and use runtime checks for API 31 features
B. Set minSdk = 21 and targetSdk = 21
C. Set minSdk = 31 and targetSdk = 31
D. Set compileSdk = 21 and minSdk = 31
Solution
Step 1: Understand minSdk and targetSdk roles
minSdk is the oldest supported version; targetSdk is the optimized version.
Step 2: Use runtime checks for new features
To support API 21 devices but use API 31 features, keep minSdk = 21, set targetSdk = 31, and check API level at runtime before using new features.
Step 3: Evaluate options
Set minSdk = 21, targetSdk = 31, and use runtime checks for API 31 features correctly sets minSdk and targetSdk and mentions runtime checks. Others either restrict support or use wrong compileSdk.
Final Answer:
Set minSdk = 21, targetSdk = 31, and use runtime checks for API 31 features -> Option A
Quick Check:
minSdk low + targetSdk high + runtime checks = safe feature use [OK]
Hint: Use runtime API checks to support older devices safely [OK]
Common Mistakes:
Raising minSdk and losing older device support
Not using runtime checks for new APIs
Setting compileSdk lower than targetSdk
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.