flutter A problem occurred configuring root project 'fluttertoast'.

Posted qqcc1388

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了flutter A problem occurred configuring root project 'fluttertoast'.相关的知识,希望对你有一定的参考价值。

flutter打包android的release包的时候报错,由于之前升级过flutter版本,打包的这个工程又是升级之前创建的,然后在执行flutter build apk的时候报错

* What went wrong:
A problem occurred configuring root project 'fluttertoast'.
> SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.

很难受,这种关于安卓配置的问题报错,有点让人摸不着头脑,各种百度,各种谷歌搜索,都没有能好到比较好的解决方案,可是包还是要打啊,要不然,不是白开发了,于是创建了一个更新后的flutter工程,比较了一下build.gradle这个文件,发现里面版本号是有差异的,
更新对应version到最新

    ext.kotlin_version = '1.3.50'
    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }

如果出现 Minimum supported Gradle version

   > Minimum supported Gradle version is 5.4.1. Current version is 4.4.1. If using the gradle wrapper, try editing the distributionUrl in /Users/chenhao/tiny/Git/flutter/xxs/android/gradle/wrapper/gradle-wrapper.properties to gradle-5.4.1-all.zip

出现上述问题,则需要找到 android/gradle/wrapper/gradle-wrapper.properties这个文件,并且把distributionUrl更新成 distributionUrl=https://services.gradle.org/distributions/gradle-5.4.1-all.zip
gradle-5.4.1-all.zip上面提示对应的名字

如果卡在Running Gradle task ‘assembleRelease‘... 可以修改

      // google()
        // jcenter()
        maven{ url 'https://maven.aliyun.com/repository/google' }
        maven{ url 'https://maven.aliyun.com/repository/jcenter' }
        maven{url 'http://maven.aliyun.com/nexus/content/groups/public'}

执行 flutter build apk

Running Gradle task 'assembleRelease'...                                
Running Gradle task 'assembleRelease'... Done                       9.2s
? Built build/app/outputs/apk/release/app-release.apk (21.4MB).

问题解决,处理这个问题,花费了好几个小时,由于之前主要从事ios相关app开发,对应安卓上面遇到的问题,会比较懵逼,好在功夫不负有心人,总算解决了,这里记录下,希望以后再遇到类似的可以回去查看

以上是关于flutter A problem occurred configuring root project 'fluttertoast'.的主要内容,如果未能解决你的问题,请参考以下文章

Educational Codeforces Round 48 (Rated for Div. 2) B. Segment Occurrences(数组前缀和防TLE)

HOW TO REPLACE ALL OCCURRENCES OF A CHARACTER IN A STD::STRING

codeforces 1000F One Occurrence

Flutter:gradle build failed with error "A problem occurred evaluation root project 'android' &g

求解答在eclipse中运行Android项目出现的问题 ——Launching MyFirstAPP' has encountered a program. Errors occurre

Leetcode-5083 Occurrences After Bigram(Bigram 分词)