0

My error in flutter run SO: Ubuntu 18.08 LTS

flutter run
Launching lib/main.dart on moto g 6 play in debug mode...
Initializing gradle...                                       0,7s
Resolving dependencies...                                        
* Error running Gradle:
Exit code 1 from: /home/leonardo/Github/apps-with-flutter/contador_de_pessoas/android/gradlew app:properties:
Starting a Gradle Daemon (subsequent builds will be faster)

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

FAILURE: Build failed with an exception.

* Where:
Build file '/home/leonardo/Github/apps-with-flutter/contador_de_pessoas/android/app/build.gradle' line: 25

* What went wrong:
A problem occurred evaluating project ':app'.
> Could not resolve all files for configuration 'classpath'.
   > Could not find lint-gradle-api.jar (com.android.tools.lint:lint-gradle-api:26.1.2).
     Searched in the following locations:
         https://jcenter.bintray.com/com/android/tools/lint/lint-gradle-api/26.1.2/lint-gradle-api-26.1.2.jar

* 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 4s


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

Executing ./android/gradlew return ok!

leonardo@cintra:~/Github/apps-with-flutter/contador_de_pessoas$ ./android/gradlew
Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details

> Task :help 

Welcome to Gradle 4.4.

To run a build, run gradlew <task> ...

To see a list of available tasks, run gradlew tasks

To see a list of command-line options, run gradlew --help

To see more detail about a task, run gradlew help --task <task>


BUILD SUCCESSFUL in 2s
1 actionable task: 1 executed

Please, help me!

  • Possible duplicate of [Flutter is not running?](https://stackoverflow.com/questions/53002073/flutter-is-not-running) – M.Ricciuti Oct 26 '18 at 12:42
  • see https://stackoverflow.com/questions/52945041/couldnt-locate-lint-gradle-api-26-1-2-jar-for-flutter-project and this anwser : https://stackoverflow.com/a/52947028/6899896 – M.Ricciuti Oct 26 '18 at 12:43

2 Answers2

0

Resolved!

I followed the orientation of the @M.Ricciut https://stackoverflow.com/a/52947028/6899896

it worked! But I gave this error (You have not accepted the license agreements of the following SDK components) and solved it

0

Flutter itself is the issue. For some of the discussion about it: https://github.com/flutter/flutter/pull/23397

In short, following Mahi-K from the above link, you have to edit $flutterRoot/packages/flutter_tools/gradle/flutter.gradle

buildscript {
    repositories {
        google()
        jcenter()
        maven {
            url 'https://dl.google.com/dl/android/maven2'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
    }
}

In the gradle wrapper properties gradle/wrapper/gradle-wrapper.properties you may also have to change it to 4.6 or above

distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
vzipp
  • 350
  • 3
  • 8