Flutter运行出现与fluwx相关的错误

错误信息

* Error running Gradle:
ProcessException: Process "/Users/youraccount/git/dapp/android/gradlew" exited abnormally:

> Configure project :app
WARNING: API 'variant.getMergeAssets()' is obsolete and has been replaced with 'variant.getMergeAssetsProvider()'.
It will be removed at the end of 2019.
For more information, see https://d.android.com/r/tools/task-configuration-avoidance.
To determine what is calling variant.getMergeAssets(), use -Pandroid.debug.obsoleteApi=true on the command line to
display a stack trace.
WARNING: API 'variantOutput.getProcessResources()' is obsolete and has been replaced with
'variantOutput.getProcessResourcesProvider()'.
It will be removed at the end of 2019.
For more information, see https://d.android.com/r/tools/task-configuration-avoidance.
To determine what is calling variantOutput.getProcessResources(), use -Pandroid.debug.obsoleteApi=true on the command
line to display a stack trace.

> Configure project :fluwx
         *********************************************************
WARNING: This version of device_info will break your Android build if it or its dependencies aren't compatible with
AndroidX.
         See https://goo.gl/CP92wY for more information on the problem and how to fix it.
         This warning prints for all Android build failures. The real root cause of the error may be unrelated.
         *********************************************************

Project evaluation failed including an error in afterEvaluate {}. Run with --stacktrace for details of the
afterEvaluate {} error.

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':fluwx'.
> Could not resolve all artifacts for configuration ':fluwx:classpath'.
   > Could not download builder.jar (com.android.tools.build:builder:3.4.1)
      > Could not get resource
      'https://dl.google.com/dl/android/maven2/com/android/tools/build/builder/3.4.1/builder-3.4.1.jar'.
         > SSL peer shut down incorrectly

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

* Get more help at https://help.gradle.org

BUILD FAILED in 41s
  Command: /Users/youraccount/git/dapp/android/gradlew app:properties


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

解决方法

若运行时出现与fluwx相关问题(如上),请查看~/flutter sdk目录/.pub-cache/fluwx/android/build.gradle/中的gradle:

dependencies {
    # 此处的gradle版本需与本地配置对应
    classpath 'com.android.tools.build:gradle:3.4.1'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}

项目目录/android/build.gradle中的gradle版本配置需保持一致;
dependencies {
# 版本需要一致
classpath 'com.android.tools.build:gradle:3.4.1'
// 添加了Kotlin编译插件
}

同时,需保证下面2个版本能对应上,版本对应详见Update Gradle

  • 项目目录/android/build.gradle中的com.android.tools.build:gradle
  • 项目目录/android/gradle/wrapper/gradle-wrapper.properties中的distributionUrl

fluwx官方Q&A

你可能感兴趣的:(Flutter运行出现与fluwx相关的错误)