android-studio – 未配置Dart SDK

前端之家收集整理的这篇文章主要介绍了android-studio – 未配置Dart SDK前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我安装了Flutter并设置了 Android Studio.然后我在GitHub( https://github.com/flutter/flutter)上克隆了一个颤动的例子并在Android Studio中启动它,但它警告我“Dart SDK未配置”,这也发生在我的同事身上.但是,如果我在Android Studio中创建一个新项目,则完全没问题.

我做了什么:

>安装颤振
>安装Android Studio,以及包括Dart插件的Flutter插件
>在命令行中颤动运行正常,所有五个测试都通过了. (见下文)

[✓] Flutter (on Mac OS X 10.13.3 17D47,locale en-US,channel dev)
• Flutter version 0.0.22 at /Users/katelyn/flutter
• Framework revision 3001b3307d (7 days ago),2018-01-30 11:37:15 -0800
• Engine revision 8f2d72b183
• Tools Dart version 2.0.0-dev.16.0
• Engine Dart version 2.0.0-edge.7af4db0ea091dddca6b2da851e6dda8d7f9467e8

[✓] Android toolchain – develop for Android devices (Android SDK 27.0.3)
• Android SDK at /Users/katelyn/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-27,build-tools 27.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b08)

[✓] iOS toolchain – develop for iOS devices (Xcode 9.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 9.2,Build version 9C40b
• ios-deploy 1.9.2
• CocoaPods version 1.4.0

[✓] Android Studio (version 3.0)
• Android Studio at /Applications/Android Studio.app/Contents
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b08)

[✓] Connected devices
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 7.1.1 (API 25) (emulator)

上周,我可以通过命令行运行他们的示例(在该目录中),

flutter run

但现在我用Gradle显示了一些错误.

Launching lib/main.dart on Android SDK built for x86 in debug mode…
Initializing gradle… 0.7s
Resolving dependencies…
* Error running Gradle:
Exit code 1 from: /Users/katelyn/AndroidStudioProjects/flutter/examples/flutter_gallery/android/gradlew app:properties:

FAILURE: Build Failed with an exception.

  • Where:
    Build file ‘/Users/katelyn/AndroidStudioProjects/flutter/examples/flutter_gallery/android/app/build.gradle’ line: 20

  • What went wrong:
    A problem occurred evaluating project ‘:app’.
    3

  • Try:
    Run with –stacktrace option to get the stack trace. Run with –info or –debug option to get more log output.

  • Get more help at 07001

BUILD Failed in 0s

Please review your Gradle project setup in the android/ folder.

提前抱歉,我没有足够的声誉上传照片.

解决方法

从git导入flutter项目后我遇到了同样的问题.这些是解决问题的步骤.

>文件 – >设置 – >语言&框架带>颤振
>选择flutter SDK路径:第一次安装颤振时,我们选择应安装颤振的位置.选择这个位置.
>单击确定,android工作室将刷新.如果问题得到解决,继续进行.
>如果您仍然遇到错误.
>转到this链接并安装Dart.
>在设置中转到相同的位置,..语言& Framework-> Dart并选择SDK位置.

解决了我的问题.

原文链接:https://www.f2er.com/android/317613.html

猜你在找的Android相关文章