美文网首页
Flutter学习----Error runing Gradle

Flutter学习----Error runing Gradle

作者: 二营长家的张大炮 | 来源:发表于2019-12-02 15:54 被阅读0次
    Launching lib/main.dart on Android SDK built for x86 in debug mode...
    Initializing gradle...
    Resolving dependencies...
    * Error running Gradle:
    ProcessException: Process "/Users/rabbit/develop/android/flutter_app/android/gradlew" exited abnormally:
    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 '/Users/rabbit/develop/android/flutter_app/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 0s
      Command: /Users/rabbit/develop/android/flutter_app/android/gradlew app:properties
    
    Finished with error: Please review your Gradle project setup in the android/ folder.
    

    解决方法:
    第一步:
    修改android/build.gradle

    buildscript {
        ext.kotlin_version = '1.2.71'
        repositories {
    //        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' }
        }
    
        dependencies {
            classpath 'com.android.tools.build:gradle:3.2.1'
            classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        }
    }
    
    allprojects {
        repositories {
    //        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 SDK安装目录下的\packages\flutter_tools\gradle的flutter.gradle文件

    buildscript {
        repositories {
            //jcenter()
            // maven {
            //     url 'https://dl.google.com/dl/android/maven2'
            // }
            maven{
                url 'https://maven.aliyun.com/repository/jcenter'
            }
            maven{
                url 'http://maven.aliyun.com/nexus/content/groups/public'
            }
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.1.2'
        }
    }
    

    相关文章

      网友评论

          本文标题:Flutter学习----Error runing Gradle

          本文链接:https://www.haomeiwen.com/subject/felfgctx.html