Flutter is not running?

前端 未结 3 964
攒了一身酷
攒了一身酷 2020-12-12 06:32

I have some problems while running flutter in android studio

This is my error Launching lib\\main.dart on Moto C Plus in debug mode... I

相关标签:
3条回答
  • 2020-12-12 07:07

    I found a solution! Go to your flutter folder. After you need to find flutter.gradle. On my PC: C:\src\flutter\packages\flutter_tools\gradle Open flutter.gradle with note or notepad and change buildscript from this:

     repositories {
       jcenter()
        maven {
            url 'https://dl.google.com/dl/android/maven2'
        }    
    }
    

    to this:

     repositories {
        maven {
            url 'https://dl.google.com/dl/android/maven2'
        } 
        jcenter()
    }
    
    0 讨论(0)
  • 2020-12-12 07:18

    There were lots of similar issues raised the past days, that could be solved by adding the google() repository in first position in the repositories block of the build scripts. See detailed explanation in the following answers:

    • couldn't locate lint-gradle-api-26.1.2.jar for flutter project
    • Could not find play-services-basement.aar
    • https://stackoverflow.com/a/52982816/6899896
    • Could not find com.android.tools.build:aapt2:3.2.0

    The root cause , related to missing libraries in Jcenter, is explained in detail here : https://stackoverflow.com/a/50885939/6899896

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

    Open the root flutter folder in your computer, and open the gradle folder in that root folder (For example C:\flutter\package\flutter_tool\gradle) and add 'google()' to the buildscript. It fixed the issue for me.

    Flutter root folder:

    Add 'google()' to the buildscript:

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