无法找到哈希字符串为“android-P”的目标。

3

我正在按照这个教程页面进行操作,但是出现了和页面中相同的错误。

在D:\Development\Android\Sdk中未找到哈希字符串为“android-P”的目标。 安装缺少的平台并同步项目。

enter image description here

当我点击安装缺失的平台并同步项目时,显示以下错误:

enter image description here

无法下载所有软件包!以下软件包不可用:
- Package id platforms;android-P

enter image description here

enter image description here

我已经安装了几乎所有ANDROID-P所需的SDK。

3个回答

4
你正在寻找与版本“android-p”相对应的SDK。看一下你的build.gradle文件: android { compileSDKVersion 'android-p' .......... } 将它改为 android { compileSDKVersion 28 .......... } 请注意,版本28只是一个例子,你可能在使用任何版本。
这样应该就能帮到你了。

谢谢您的回复,但是仍然没有帮助 :( - Nishanth Kr

0

我按照Bevilaqua的答案进行操作。

然后,弹出一个对话框要求更新Gradle插件: Android Gradle Plugin Update Required

当然,它失败了: enter image description here

因此,为了解决这个问题,我在我的.gradle文件夹中手动安装了最新版本的Gradle,下载链接在enter link description here(在Windows中是C:\Users\...\.gradle\wrapper\dists\)。

又遇到一个问题,因为styles.xml中的这行代码: <style name="Widget.Shrine.TextInputLayout" parent="Widget.MaterialComponents.TextInputLayout.OutlineBox"> 我把OutlineBox替换成OutlinedBox<style name="Widget.Shrine.TextInputLayout" parent="Widget.MaterialComponents.TextInputLayout.OutlinedBox"> (源代码) 现在一切都正常了。


0

谢谢您的回复,但仍然没有帮助 :( - Nishanth Kr

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接