打包時疏忽了一個重要的一點,進行打包時報了:
If you are deploying the app to the Play Store, it's recommended to use app bundles or split the APKto reduce the APK size.
To generate an app bundle, run:
flutter build appbundle --target-platform android-arm,android-arm64,android-x64
Learn more on: https://developer.android.com/guide/app-bundle
To split the APKs per ABI, run:
flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi
Learn more on:
https://developer.android.com/studio/build/configure-apk-splits#configure-abi-split
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... FAILURE: Build failed with an exception.
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... * What went wrong:
Running Gradle task 'assembleRelease'... Execution failed for task ':app:lintVitalRelease'.
Running Gradle task 'assembleRelease'... > Could not resolve all files for configuration ':app:lintClassPath'.
Running Gradle task 'assembleRelease'... > Could not download groovy-all.jar (org.codehaus.groovy:groovy-all:2.4.15)
Running Gradle task 'assembleRelease'... > Could not get resource 'https://jcenter.bintray.com/org/codehaus/groovy/groovy-all/2.4.15/groovy-all-2.4.15.jar'.
Running Gradle task 'assembleRelease'... > Connection reset
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... * Try:
Running Gradle task 'assembleRelease'... 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.
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... * Get more help at https://help.gradle.org
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... BUILD FAILED in 12m 18s
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done 738.9s (!)
Gradle task assembleRelease failed with exit code 1
很明顯是網路不好(大家都懂得)
但是可以運行起來,簽名配置簽名,都干了,就最后打包時報了錯,過了還才意識到,沒盡興鏡像配置,我只全域進行了配置,只在構建第一個專案時進行了專案中的鏡像配置,而我打包的是第三個專案,也就是說第二這和第三個都沒進行鏡像配置,所以才會網路出錯,然后照著第一個flutter專案把第三個專案配置了一下,不一會就打包成功了
但是其實我在打包報錯是還用了另一種方法,找個梯子,可惜這個梯子訪問一些特別的網站還行,速度也挺快,對于flutter打包使用的外網還是不好使,幸好及時發現對鏡像配置這一點的疏忽,不然還不知道要卡多久??,
另外在網上找答案是又找到這樣一個解決報錯的方法
What went wrong:
Could not resolve all files for configuration ':app:debugCompileClasspath'.
> Could not resolve com.google.android.gms:play-services-ads:latest.release.
Required by:
project :app
> Could not resolve com.google.android.gms:play-services-ads:12.0.1.
> Could not get resource 'https://jcenter.bintray.com/com/google/android/gms/play-services-ads/12.0.1/play-services-ads-12.0.1.pom'.
> Could not GET 'https://jcenter.bintray.com/com/google/android/gms/play-services-ads/12.0.1/play-services-ads-12.0.1.pom'.
> Read timed out
* 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
配置如下代碼
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.1' //和專案里面的版本一樣
classpath 'com.google.gms:google-services:4.0.1' //這行對谷歌服務庫進行依賴
}
}
allprojects {
repositories {
google()
jcenter()
mavenCentral ()
maven {url 'https://dl.bintray.com/jetbrains/anko'} //這是你需要加入的,這個是解決這個問題的關鍵地方,我就是添加這個maven后不再報上面的錯誤了
maven {url "https://maven.google.com"} //谷歌廣告
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
這個我并沒有用,但既然針對我這幾行報錯的鏡像解決方法,應該會管用(這個是解決Android開發報錯的),所以寫在這里
這個我沒有用到的解決方法的地址
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/200244.html
標籤:Dart
上一篇:爬蟲入門經典(十六) | 一文帶你爬取斗魚主播相關資訊
下一篇:分享一個小清新的論壇原始碼
