无法使用哈希字符串 'android-O' 定位

failed to target with hash string 'android-O'

我在将 targetSDKVersion 更新为 android oreo

时收到此错误

Error:Failed to find target with hash string 'android-O' in: C:\Users\admin\AppData\Local\Android\Sdk

Install missing platform(s) and sync project

当我点击“安装缺少的平台和同步项目”时,它显示了一个包含此消息的弹出窗口。

我更新了 android SDK,但它一直显示此弹出窗口。

为此需要解决方案。

要全面测试您的应用与 AndroidP 的兼容性并开始使用新的 API,请打开您的 模块级别build.gradle 文件并更新 compileSdkVersion and targetSdkVersion,如下所示:

android {
    compileSdkVersion 28

    defaultConfig {
        targetSdkVersion 28
    }
    ...
}

阅读Set Up the Android P SDK