LoginSignup
6
2

More than 5 years have passed since last update.

Flutter:起動実績のあるプロジェクトが起動しなくなった時の備忘録

Posted at

久々にAndroid StudioとかVS Codeとか起動したらアップデートの通知が来ていたので、なんも考えずやってしまったら、Flutterプロジェクトが起動しなくなってしまった。
Android Studio、VS Codeともに同じ現象が発生する。

以下、エラー内容。

FAILURE: Build failed with an exception.

* What went wrong:
Could not create service of type ScriptPluginFactory using BuildScopeServices.createScriptPluginFactory().
> Could not create service of type ResourceSnapshotterCacheService using GradleUserHomeScopeServices.createResourceSnapshotterCacheService().

* 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 1s
  Command: D:\work\sampleProject\android\gradlew.bat app:properties
Please review your Gradle project setup in the android/ folder.
Exited (sigterm)

gradle がどうとかいうてるので、Android Studio のインストールフォルダを見てみると、「gradle-5.1.1」なるフォルダが見受けられた。プロジェクトで参照している gradle とのバージョン不一致ということらしい。
以下のように変更して起動確認。

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
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip

(変更後)
#Fri Jun 23 08:50:38 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
6
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
2