码迷,mamicode.com
首页 > 其他好文 > 详细

flutter A problem occurred configuring root project 'fluttertoast'.

时间:2020-03-02 23:26:29      阅读:439      评论:0      收藏:0      [点我收藏+]

标签:min   classpath   edit   安卓   更新   gradle   需要   有心人   version   

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'.

标签:min   classpath   edit   安卓   更新   gradle   需要   有心人   version   

原文地址:https://www.cnblogs.com/qqcc1388/p/12398295.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!