📜  necessarAndroid SDK 不包括您的 28 的目标 SDK. (1)

📅  最后修改于: 2023-12-03 15:03:09.239000             🧑  作者: Mango

Introduction to the missing target SDK in Android SDK

As an Android programmer, you may encounter the error message - "Android SDK does not include your 28 target SDK". This error message means that you have set your project's target SDK to version 28 but your Android SDK installation does not include the necessary components for that version.

To resolve this issue, you need to install the missing components through the Android SDK Manager. Here's how you can do it:

  1. Open Android Studio and go to the "SDK Manager" from the "Welcome to Android Studio" screen or from the "File" menu.
  2. In the SDK Manager, select the "SDK Platforms" tab.
  3. Scroll down to find the "Android 9.0 (Pie)" option and check the checkbox next to it.
  4. Click "Apply" and wait for the installation process to complete.
  5. Once it's done, you can go back to your project and set the target SDK to 28.

With the target SDK installed, you can take advantage of the new features and improvements available for your app. However, keep in mind that some devices may not support the latest target SDK version, so you may need to set a minimum SDK version for broader compatibility.

In conclusion, missing target SDK components can cause errors in your Android project, but the solution is easy - just install the missing components through the SDK Manager. By doing so, you can take advantage of the latest features for your app and ensure broader compatibility across devices.

// Sample code to set the target and minimum SDK version
android {
    defaultConfig {
        targetSdkVersion 28
        minSdkVersion 19
        // other configuration options...
    }
    // other build configurations...
}