flutter app: A problem occurred configuring root project 'android'

前端 未结 2 774
旧巷少年郎
旧巷少年郎 2020-12-21 17:29

I have install windows 10 64 bit and Android studio 64 bit. Making android apps work great. Everything is OK.

I have install Flutter SDK. This is result of \"flutter

相关标签:
2条回答
  • 2020-12-21 18:06

    I exactly had this problem and solved it as below:

    1. Download the latest flutter SDK version and assign it to your project.
    2. In your flutter project go to the android directory and change the gradle version from 3.5.0 to 3.4.2. Note that to do this change in your build.gradle of your project and not the app gradle:
    
        buildscript {
            ext.kotlin_version = '1.3.50'
            repositories {
                google()
                jcenter()
            }
    
            dependencies {
                classpath 'com.android.tools.build:gradle:3.4.2'
                classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
            }
        }
    
    
    1. Also, change your gradle version of distributionUrl property to 5.1.1 in the "gradle-wrapper.properties" file, that is in your android directory (your-flutter-app\android\gradle\wrapper\gradle-wrapper.properties):
    
        distributionBase=GRADLE_USER_HOME
        distributionPath=wrapper/dists
        zipStoreBase=GRADLE_USER_HOME
        zipStorePath=wrapper/dists
        distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
    
    

    Note: When you change your gradle version that is in "gradle-wrapper.properties", you should wait until the download of the new version of the gradle will be finished.

    Now you can run your project in your device or emulator :)

    0 讨论(0)
  • 2020-12-21 18:12

    Solved this problem by renaming the current project 'project_save' recreating a new Flutter project called the same name as the former one and then copied all the asset files, src code, android manifest, key, icon, script and pubspec.yaml to the new one. Took 15mn against a whole day yesterday trying to figure out the issue...

    0 讨论(0)
提交回复
热议问题