且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Flutter:找不到SDK位置.在local.properties文件中使用sdk.dir或使用ANDROID_HOME环境变量定义位置

更新时间:2021-10-13 22:40:32

有时您会从需要最新gradle才能实际运行的插件中看到SDK问题.

即使我的SDK设置正确,我也遇到了这个问题:

找不到

SDK位置.在sdk.dir中定义位置 local.properties文件或带有ANDROID_HOME环境变量.

SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.

更多信息来自:

这是一个插件故障的示例,它将导致sdk和查询错误 flutter_file_picker :

Build is failing with unexpected element <queries> found in <manifest>.

升级gradle:

要在Flutter项目中升级gradle,请文件->打开,然后选择Flutter应用程序中包含的Android文件夹.完成加载后,它将提示您将gradle升级到最新版本.这样可以解决问题

To upgrade gradle in a flutter project, File -> Open and select the Android folder which is part of your Flutter application. When that finishes loading, it will prompt you to upgrade gradle to the latest version. This will resolve the issue