Flutterの勉強はじめてみました。
ほぼアプリ開発は未経験ですがつまづいたところをシェア。
環境
- Mac
- Android Studio 3.5.1
- Flutter 1.9.1
現象
Flutterで$ flutter run -d all
するとandroid側のみエラーとなる。
エラーログ
$ flutter run -d all
~省略~
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not download builder-test-api.jar (com.android.tools.build:builder-test-api:3.2.1)
> Could not get resource
'https://dl.google.com/dl/android/maven2/com/android/tools/build/builder-test-api/3.2.1/builder-test-api-
3.2.1.jar'.
> Could not GET
'https://dl.google.com/dl/android/maven2/com/android/tools/build/builder-test-api/3.2.1/builder-test-a
pi-3.2.1.jar'.
> Connect to dl.google.com:443 [dl.google.com/216.58.197.206] failed: Bad file descriptor (connect
failed)
> Could not download layoutlib-api.jar (com.android.tools.layoutlib:layoutlib-api:26.2.1)
> Could not get resource
~省略~
* 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 5s
Command: /Users/yuta/dev/my_app/android/gradlew app:properties
Please review your Gradle project setup in the android/ folder.
修正内容
- android側のディレクトリで利用するGradleのバージョンを使っているAndroidプラグインの環境と合わせる
# ファイルパス
/android/gradle/wrapper/gradle-wrapper.properties
#Fri Jun 23 08:50:38 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
# 4.10.2を5.1.1に変える
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip