我已经将HarmonyOS SDK从DevEcoStudio的5升级到6。我只看到SDK6在“文件->设置->外观&行为->系统设置-> HarmonyOS SDK”下面
现在,当我尝试用SDK 5打开一个项目时,DevEco问我下面这个-
在选择"Use的HarmonyOS SDK“之后,向我展示了下面的-
所以,在设置SDK之后,当我试图“打开”一个现有的项目时,我看到了以下错误.
Unable to download the HarmonyOS SDK. Unable to install java:2.1.1.21 as the license has not been accepted. Use the 'File -> Settings -> Appearance & Behavior -> System Settings -> HarmonyOS SDK' to agree to the license agreement and download.
IDE中的日志看起来如下-
我们如何修复这个问题并成功地打开这个项目?
DevEcoStudio and SDK Version Info:
DevEco Studio 2.1 Release //Still Old Version of DevEcoStudio
Build Version: 2.1.0.501, built on June 2, 2021
Runtime version: 11.0.9+11-b944.49 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
open-source software
Windows 10 10.0
GC: ParNew, ConcurrentMarkSweep
Memory: 1484M
Cores: 8
Registry: external.system.auto.import.disabled=true
SDK Version: 6 //latest received Offline```
发布于 2021-12-03 08:37:54
因此,为了在SDK升级之后成功编译项目,需要-
打开项目级别和模块级别的compileSdkVersion build.gradle,并将该build.gradle更改为最新版本。
compileSdkVersion 6 // Target SDK version for building your app.
defaultConfig {
compatibleSdkVersion 5 //Earliest SDK version compatible with your app.
}
您可以检查构建Config以获得更多HarmoyOS项目配置。
https://stackoverflow.com/questions/70211512
复制相似问题