无法“颤动".由于无法安装SDK,但Flutter Doctor运行正常 [英] Unable to "flutter run" due to failure to install SDK but flutter doctor runs fine

查看:134
本文介绍了无法“颤动".由于无法安装SDK,但Flutter Doctor运行正常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

flutter doctor输出是

C:\ WINDOWS \ system32> Flutter Doctor医生摘要(查看全部 详细信息,请运行Flutter Doctor -v): [√] Flutter(频道稳定,v1.0.0,>在Microsoft Windows [Version 10.0.17134.523],语言环境en-US) [√] Android工具链-为Android设备开发(Android SDK 27.0.3) [√] Android Studio(版本3.2)[√] VS Code,64位版本(版本 1.31.1) [√]已连接的设备(1个可用)

C:\WINDOWS\system32> flutter doctor Doctor summary (to see all details, run flutter doctor -v): [√] Flutter (Channel stable, v1.0.0,> on Microsoft Windows [Version 10.0.17134.523], locale en-US) [√]Android toolchain - develop for Android devices (Android SDK 27.0.3) [√] Android Studio (version 3.2) [√] VS Code, 64-bit edition (version 1.31.1) [√] Connected device (1 available)

•找不到问题!

如您所见,没有发现任何问题,但是当我已经安装28时,但是flutter正在检测最新安装为27的sdk.

as you can see no issues found BUT flutter is detecting latest sdk installed as 27 when i have installed 28 already.

当我尝试从vs代码编写一个应用程序(文档中的第一个示例应用程序)时,出现此错误

when i try to flutter run from vs code an app(first sample app from docs) i get this error

失败:构建失败,并出现异常.

FAILURE: Build failed with an exception.

  • 其中:构建文件'D:\ VSProjects \ Flutter \ myapp \ android \ build.gradle'行:24

  • Where: Build file 'D:\VSProjects\Flutter\myapp\android\build.gradle' line: 24

出了什么问题:评估根项目"android"时出现问题.

What went wrong: A problem occurred evaluating root project 'android'.

配置项目':app'时发生问题. 无法安装以下SDK组件: build-tools; 28.0.3 Android SDK Build-Tools 28.0.3 SDK目录不可写(C:\ Program Files(x86)\ Android \ android-sdk)

A problem occurred configuring project ':app'. Failed to install the following SDK components: build-tools;28.0.3 Android SDK Build-Tools 28.0.3 The SDK directory is not writable (C:\Program Files (x86)\Android\android-sdk)

我尝试更改文件的权限以删除只读访问权限,但仍然收到相同的错误,我使用相同的SDK来构建带有android studio(native)和visual studio(xamarin)的android应用程序,效果很好...我已经安装了最新的sdk版本,所以为什么flutter会给我这个错误?

i tried changing the permission of the file to remove read-only access and still get the same error, i use the same sdk to build android apps with android studio(native) and visual studio(xamarin) just fine...i have the latest sdk version installed already so why is flutter giving me this error?

我可以以某种方式降低我的sdk要求吗?

Can i downgrade my sdk requirement somehow?

推荐答案

您不应该将Android SDK安装到C:\Program Files (x86)中,而这需要更高的特权才能进行编写. Android Studio似乎已将其安装到当前用户具有足够权限的C:\Users\someUser\AppData\Local\Android\Sdk中.

You shoudn't install the Android SDK into C:\Program Files (x86) which requires elevated privileges to write. Android Studio seems to install it into C:\Users\someUser\AppData\Local\Android\Sdk where the current user has sufficient privileges.

这篇关于无法“颤动".由于无法安装SDK,但Flutter Doctor运行正常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆