简体   繁体   English

由于安装 SDK 失败,无法“flutter run”,但 flutter doctor 运行良好

[英]Unable to "flutter run" due to failure to install SDK but flutter doctor runs fine

flutter doctor output on windows is Windows 上的flutter doctor输出是

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) C:\\WINDOWS\\system32> flutter doctor Doctor summary(查看所有详细信息,运行 flutter doctor -v):[√] Flutter(Channel stable,v1.0.0,> on Microsoft Windows [Version 10.0.17134.523],locale en- US) [√]Android 工具链 - 为 Android 设备开发(Android SDK 27.0.3) [√] Android Studio(3.2 版) [√] VS Code,64 位版本(1.31.1 版) [√] 已连接设备( 1 个可用)

• No issues found! • 未发现问题!

as you can see no issues found BUT flutter is detecting latest sdk installed as 27 when i have installed 28 already.正如您所看到的,没有发现任何问题,但是当我已经安装了 28 时,flutter 正在检测安装为 27 的最新 sdk。

when i try to flutter run from vs code an app(first sample app from docs) i get this error当我尝试从 vs 代码flutter run应用程序(来自文档的第一个示例应用程序)时,我收到此错误

FAILURE: Build failed with an exception. FAILURE:构建失败,出现异常。

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

  • What went wrong: A problem occurred evaluating root project 'android'.出了什么问题:评估根项目“android”时出现问题。

    A problem occurred configuring project ':app'.配置项目“: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 组件: build-tools;28.0.3 Android SDK Build-Tools 28.0.3 SDK 目录不可写 (C:\\Program Files (x86)\\Android\\android-sdk)

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 使用 android studio(native) 和 Visual Studio(xamarin) 构建 android 应用程序就好了……我有已经安装了最新的 sdk 版本,为什么 flutter 给我这个错误?

Can i downgrade my sdk requirement somehow?我可以以某种方式降级我的 sdk 要求吗?

You shoudn't install the Android SDK into C:\\Program Files (x86) which requires elevated privileges to write.您不应将 Android SDK 安装到需要提升写入权限的C:\\Program Files (x86)中。 Android Studio seems to install it into C:\\Users\\someUser\\AppData\\Local\\Android\\Sdk where the current user has sufficient privileges. Android Studio 似乎将其安装到C:\\Users\\someUser\\AppData\\Local\\Android\\Sdk中,当前用户具有足够的权限。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法定位 android SDK for flutter 医生 - Unable to locate android SDK for flutter doctor Flutter 应用程序在使用 release apk 启动时崩溃,但使用“flutter run”运行良好 - Flutter app crash on startup with release apk, but runs fine with 'flutter run' 无法运行 flutter 博士 - - 执照 - Cant run flutter doctor - - license Flutter 运行失败 [INSTALL_FAILED_OLDER_SDK] 需要更新的 sdk 版本 #31(当前版本为 #30) - Flutter Run Failure [INSTALL_FAILED_OLDER_SDK] Requires newer sdk version #31 (current version is #30) Flutter Doctor 找不到 Android SDK - Flutter Doctor can't find Android SDK flutter医生:找不到捆绑的java版本 - flutter doctor: unable to find the bundled java version 无法运行 flutter 医生 --android-licenses - Cannot run flutter doctor --android-licenses 无法定位开发设备; 请运行“flutter doctor”以获取有关安装其他组件的信息。 在 VS Code 上 - Unable to locate a development device; please run 'flutter doctor' for information about installing additional components. on VS Code Android Sdk manager not found- Flutter doctor error - Android Sdk manager not found- Flutter doctor error Flutter:由于 android:export 错误而无法运行应用程序 - Flutter: Unable to run the app due to android:export error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM