flutter 安卓 打包爬坑之路

flutter build apk

1、出現(xiàn)問(wèn)題

* 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

解決問(wèn)題:在你的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、出現(xiàn)問(wèn)題

* 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?

解決方法:

修改項(xiàng)目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 完美

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容