flutter 安卓 打包爬坑之路

flutter build apk

1、出现问题

* Where:

Build file '/Users/***/**/flutterStudy/flutter_app01/android/app/build.gradle' line: 26


* What went wrong:                                                     

A problem occurred evaluating project ':app'.                         

> Could not resolve all artifacts for configuration 'classpath'.       

  > Could not resolve com.android.tools.build:gradle:3.5.0.           

    Required by:                                                     

        unspecified:unspecified:unspecified                           

      > Could not resolve com.android.tools.build:gradle:3.5.0.       

        > Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.pom'.

            > Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.pom'.

              > Connect to 127.0.0.1:1087 [/127.0.0.1] failed: Connection refused (Connection refused)

      > Could not resolve com.android.tools.build:gradle:3.5.0.       

        > Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.pom'.

            > Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.pom'.               > Connect to 127.0.0.1:1087 [/127.0.0.1] failed: Connection refused (Connection refused)* 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

解决问题:在你的gradle.properties(注意不是工程文件喽:指的是C:/Users/Administrator/.gradle夹中  MAC 电脑的本地的 gradle.properties 在用户目录下 .gradle 文件夹中)文件中把 如下配置去掉:

systemProp.http.proxyHost=127.0.0.1

systemProp.https.proxyPort=1087

systemProp.https.proxyHost=127.0.0.1

systemProp.http.proxyPort=1087

2、出现问题

* Where:

Build file '/Users/***/***/flutterStudy/flutter_app01/android/app/build.gradle' line: 26


* What went wrong:                                                     

A problem occurred evaluating project ':app'.                         

> Could not resolve all artifacts for configuration 'classpath'.       

  > Could not resolve com.google.code.findbugs:jsr305:3.0.2.         

    Required by:                                                     

        unspecified:unspecified:unspecified > com.android.tools.build:gradle:3.5.0 > com.android.tools.build:builder:3.5.0 > com.android.tools.build:apkzlib:3.5.0

      > Could not resolve com.google.code.findbugs:jsr305:3.0.2.       

        > Could not get resource 'https://jcenter.bintray.com/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.pom'.

            > Could not GET 'https://jcenter.bintray.com/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.pom'.

              > Read timed out                                       

  > Could not resolve com.google.guava:failureaccess:1.0.1.           

    Required by:                                                     

        unspecified:unspecified:unspecified > com.android.tools.build:gradle:3.5.0 > com.android.tools.analytics-library:crash:26.5.0 > com.google.guava:guava:27.0.1-jre

      > Skipped due to earlier error                                   

  > Could not resolve com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava.

    Required by:                                                     

        unspecified:unspecified:unspecified > com.android.tools.build:gradle:3.5.0 > com.android.tools.analytics-library:crash:26.5.0 > com.google.guava:guava:27.0.1-jre

      > Skipped due to earlier error                                   

  > Could not resolve com.google.code.findbugs:jsr305:3.0.2.         

    Required by:                                                     

        unspecified:unspecified:unspecified > com.android.tools.build:gradle:3.5.0 > com.android.tools.analytics-library:crash:26.5.0 > com.google.guava:guava:27.0.1-jre

      > Could not resolve com.google.code.findbugs:jsr305:3.0.2.       

        > Could not get resource 'https://jcenter.bintray.com/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.pom'.

            > Could not GET 'https://jcenter.bintray.com/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.pom'.

              > Read timed out                                       

  > Could not resolve org.checkerframework:checker-qual:2.5.2.       

    Required by:                                                     

        unspecified:unspecified:unspecified > com.android.tools.build:gradle:3.5.0 > com.android.tools.analytics-library:crash:26.5.0 > com.google.guava:guava:27.0.1-jre

      > Skipped due to earlier error                                   

  > Could not resolve org.codehaus.mojo:animal-sniffer-annotations:1.17.

    Required by:                                                     

        unspecified:unspecified:unspecified > com.android.tools.build:gradle:3.5.0 > com.android.tools.analytics-library:crash:26.5.0 > com.google.guava:guava:27.0.1-jre

      > Skipped due to earlier error                                   

  > Could not resolve commons-codec:commons-codec:1.10.               

    Required by:                                                     

        unspecified:unspecified:unspecified > com.android.tools.build:gradle:3.5.0 > com.android.tools.analytics-library:crash:26.5.0 > org.apache.httpcomponents:httpclient:4.5.6

      > Skipped due to earlier error                                   

  > Could not resolve org.jetbrains.kotlin:kotlin-stdlib-common:1.3.41.

    Required by:                                                     

        unspecified:unspecified:unspecified > com.android.tools.build:gradle:3.5.0 > org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.41 > org.jetbrains.kotlin:kotlin-stdlib:1.3.41

      > Skipped due to earlier error 

解决方法:

修改项目android/build.gradle 

buildscript {

    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'

    }

}

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 build apk 完美

你可能感兴趣的:(flutter 安卓 打包爬坑之路)