Android Gradle 问题 - Flutter/Dart

标签 android gradle dart flutter

我的 Gradle Sync 有问题。

我使用 IntelliJ 和 Android Studio 构建了一个 Flutter/Dart 应用程序。

我添加了 2 个新依赖项,现在我遇到了 Gradle 问题。 在 Android Studio 中一切正常(Gradle Sync 在没有失败或警告的情况下完成),但在 IntelliJ 中它不起作用。

Gradle build file screenshot

* Error running Gradle: Exit code 1 from: C:\Users\stesc\Documents\Programming\timecoder-flutter\android\gradlew.bat app:properties: NDK is missing a "platforms" directory. If you are using NDK, verify the ndk.dir is set to a valid NDK directory.  It is currently set to C:\Users\stesc\AppData\Local\Android\Sdk\ndk-bundle. If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.


BUILD FAILED

Total time: 4.669 secs


FAILURE: Build failed with an exception.

* Where:

Build file 'C:\Users\stesc\Documents\Programming\timecoder-flutter\android\build.gradle' line: 25

* What went wrong: A problem occurred evaluating root project 'android'.
> A problem occurred configuring project ':app'.
   > Could not resolve all dependencies for configuration ':app:_debugApk'. Finished with error: Please review your Gradle project setup in the android/ folder.
      > A problem occurred configuring project ':shared_preferences'.
         > Could not resolve all dependencies for configuration ':shared_preferences:classpath'.
            > Could not find com.android.tools.build:gradle:3.0.1.
              Searched in the following locations:
                  https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.1/gradle-3.0.1.pom
                  https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.1/gradle-3.0.1.jar
              Required by:
                  project :shared_preferences

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

More gradle build screenshot

最佳答案

1. 从项目 -> android -> 构建更新您的 gradle 版本。对我来说:

dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
}

2.使用最新的sdk工具版本

3.Tools->Flutter打开终端并运行以下命令

flutter upgrade
flutter doctor

关于Android Gradle 问题 - Flutter/Dart,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48479284/

相关文章:

android - Cordova :执行任务 ':processDebugManifest'失败。添加共享插件后

android - 不同的风格使用不同的存储库

android - 如何处理Android应用程序中标记的双击

android - 在 Car Dock 上打开应用程序?

java - Android:如何计算几天前的日期?

android - 如何在应用程序中存储大数据?

gradle - Gradle任务声明的完整语法

angular - 如何在 Angular Dart 2 中使用 'useValue' 的提供程序

flutter - 在Flutter中,将整个应用程序包装在WillPopScope中时,不会调用onWillPop

flutter - 如何在 dart 中正确进行类型转换