質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Flutter

Flutterは、iOSとAndroidのアプリを同じコードで開発するためのフレームワークです。オープンソースで開発言語はDart。双方のプラットフォームにおける高度な実行パフォーマンスと開発効率を提供することを目的としています。

Q&A

解決済

1回答

948閲覧

Flutterのギャラリーのサンプルをandroid studioで実行させたい。パート2

moriman

総合スコア615

Flutter

Flutterは、iOSとAndroidのアプリを同じコードで開発するためのフレームワークです。オープンソースで開発言語はDart。双方のプラットフォームにおける高度な実行パフォーマンスと開発効率を提供することを目的としています。

0グッド

0クリップ

投稿2020/07/13 03:17

編集2020/07/13 05:05

https://gallery.flutter.dev/
上記ページのサンプルコードをandroid stuidoで動かしたいです。

https://teratail.com/questions/276219
上記ページで質問させて頂いたのですが、
「クローンしてきて動かす方法」
というのがあるのであれば、そちらを知りたいです。

結局android studioで新しいプロジェクトを作成し、githubからダウンロードしたファイル群を参考にして必要なファイルを全て新しく作成し、コードをコピーする作業を繰り返せば実行はできると思うのですが、
それが普通の方法なのでしょうか?
大きなアプリになると「ファイル作成→コピペ」でそれなりの時間がかかると思うのですが、
プロジェクトダウンロード(クローン)→android studioで開く→実行
ということはできないのでしょうか?

2020/7/13,13:50追記
flutter doctorの実行結果です。

Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel master, 1.20.0-8.0.pre.57, on Mac OS X 10.15.5 19F101, locale ja-JP) [✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2) [✓] Xcode - develop for iOS and macOS (Xcode 11.5) [✓] Android Studio (version 4.0) [✓] Android Studio (version 4.0) [✓] Connected device (1 available)

以下に前回の質問の状況を記させて頂きます。

https://stackoverflow.com/questions/62806823/i-want-to-run-the-flutter-gallery-sample-in-android-studio
stackoverflowで質問したらgithubのリポジトリをクローンする方法を教えて頂いたのですが、クローン後に開いたandroid studioで実行ボタンが無効状態で動かすことができません。
「ダウンロードしたファイル(プロジェクト)をandroid studioで開いて動かす」ということは不可能なのでしょうか?

とりあえず(プロジェクト)ディレクトリをダウンロード(クローン)することはできるので、それを見て、新しいFlutterアプリ(プロジェクト)を自分で作成して、必要なファイルも自分で作って(コピペして)、pub getなどして、実行する、という方法しかないのでしょうか?

2020/7/13,14:00追記
main.dartのコードの上部に

Dart SDK is not configured Download Dart SDK ←リンク Open Dart settings ←リンク

というメッセージが表示されているんですが、これが原因でしょうか。
これってDart SDKが無い、ということなんですかね。
よくわからないんですが、他のアプリ(プロジェクト)は普通に動いているので、Dart SDKはすでに有ると思うのですが。
リンクを踏むと
https://dart.dev/get-dart
に行くのですが、ダウンロードする必要があるのでしょうか?

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

satokei

2020/07/13 03:53

改めて、現状を記載された方がよろしいです。 また、morimanさんの環境の問題だと思いますので、環境情報も記載してください。 (flutter doctorの結果とか)
guest

回答1

0

ベストアンサー

よくわからないんですが、他のアプリ(プロジェクト)は普通に動いているので、Dart SDKはすでに有ると思うのですが。

リンクを踏むと
https://dart.dev/get-dart
に行くのですが、ダウンロードする必要があるのでしょうか?

Dart SDKは、Flutter SDK に含まれていますので、ダウンロードの必要はありません。
とりあえず、以下ページがありましたので設定してみてください。

投稿2020/07/13 05:34

satokei

総合スコア1217

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

moriman

2020/07/13 05:41

回答を頂きましてありがとうございます。 ご提示頂いたページの通りしたら、実行ボタンを押せるようになったので、一歩前進なんですが、 実行したらエラーが出ました。以下にエラー内容を示します。 Launching lib/main.dart on Android SDK built for x86 in debug mode... Running Gradle task 'assembleDebug'... Compiler message: lib/pages/backdrop.dart:163:19: Error: No named parameter with the name 'includeSemantics'. includeSemantics: false, ^^^^^^^^^^^^^^^^ ../flutter/packages/flutter/lib/src/widgets/raw_keyboard_listener.dart:38:9: Context: Found this candidate, but the arguments don't match. const RawKeyboardListener({ ^^^^^^^^^^^^^^^^^^^ lib/pages/backdrop.dart:172:17: Error: The method 'ExcludeFocus' isn't defined for the class '_BackdropState'. - '_BackdropState' is from 'package:gallery/pages/backdrop.dart' ('lib/pages/backdrop.dart'). Try correcting the name to the name of an existing method, or defining a method named 'ExcludeFocus'. : ExcludeFocus(child: _settingsPage), ^^^^^^^^^^^^ lib/demos/material/text_field_demo.dart:225:21: Error: The getter 'FilteringTextInputFormatter' isn't defined for the class 'TextFormFieldDemoState'. - 'TextFormFieldDemoState' is from 'package:gallery/demos/material/text_field_demo.dart' ('lib/demos/material/text_field_demo.dart'). Try correcting the name to the name of an existing getter, or defining a getter or field named 'FilteringTextInputFormatter'. FilteringTextInputFormatter.digitsOnly, ^^^^^^^^^^^^^^^^^^^^^^^^^^^ lib/studies/crane/backlayer.dart:38:11: Error: The method 'ExcludeFocus' isn't defined for the class '_BackLayerState'. - '_BackLayerState' is from 'package:gallery/studies/crane/backlayer.dart' ('lib/studies/crane/backlayer.dart'). Try correcting the name to the name of an existing method, or defining a method named 'ExcludeFocus'. ExcludeFocus( ^^^^^^^^^^^^ Compiler message: lib/pages/backdrop.dart:163:19: Error: No named parameter with the name 'includeSemantics'. includeSemantics: false, ^^^^^^^^^^^^^^^^ ../flutter/packages/flutter/lib/src/widgets/raw_keyboard_listener.dart:38:9: Context: Found this candidate, but the arguments don't match. const RawKeyboardListener({ ^^^^^^^^^^^^^^^^^^^ lib/pages/backdrop.dart:172:17: Error: The method 'ExcludeFocus' isn't defined for the class '_BackdropState'. - '_BackdropState' is from 'package:gallery/pages/backdrop.dart' ('lib/pages/backdrop.dart'). Try correcting the name to the name of an existing method, or defining a method named 'ExcludeFocus'. : ExcludeFocus(child: _settingsPage), ^^^^^^^^^^^^ lib/demos/material/text_field_demo.dart:225:21: Error: The getter 'FilteringTextInputFormatter' isn't defined for the class 'TextFormFieldDemoState'. - 'TextFormFieldDemoState' is from 'package:gallery/demos/material/text_field_demo.dart' ('lib/demos/material/text_field_demo.dart'). Try correcting the name to the name of an existing getter, or defining a getter or field named 'FilteringTextInputFormatter'. FilteringTextInputFormatter.digitsOnly, ^^^^^^^^^^^^^^^^^^^^^^^^^^^ lib/studies/crane/backlayer.dart:38:11: Error: The method 'ExcludeFocus' isn't defined for the class '_BackLayerState'. - '_BackLayerState' is from 'package:gallery/studies/crane/backlayer.dart' ('lib/studies/crane/backlayer.dart'). Try correcting the name to the name of an existing method, or defining a method named 'ExcludeFocus'. ExcludeFocus( ^^^^^^^^^^^^ Target kernel_snapshot failed: Exception: Errors during snapshot creation: null build failed. FAILURE: Build failed with an exception. * Where: Script '/Users/userno1/development/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 882 * What went wrong: Execution failed for task ':app:compileFlutterBuildDebug'. > Process 'command '/Users/userno1/development/flutter/bin/flutter'' finished with non-zero exit value 1 * 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 57s Exception: Gradle task assembleDebug failed with exit code 1
satokei

2020/07/13 05:55

「flutter clean」してもダメですか?
moriman

2020/07/13 06:04

/Users/userno1/development/gallery に行き、 flutter clean を実行して、もう一度実行しましたが、同じエラー(エラー内容全部見てませんが多分同じと思われる。) が出ます。
tepci

2020/07/13 06:18

pubspec.lockを削除して、pub getしてもダメですか?
moriman

2020/07/13 06:49

pubspec.lockを削除して、pub getしましたが やはり同じエラーが出ます。 ただ「開いて実行」自体はできているので、エラーが解決されれば、あるいは元々エラーの無いプロジェクトであれば実行できると思いますので、そういう意味では解決ですね。
moriman

2020/07/14 02:40

すみません、もう一度最初からやってみたらなぜか動きました。 flutter clean などはしなくても動きました。 本当によくわからないんですが笑 この再現性ってどうなんだろう、という気はしますが。 何度もアドバイスを頂きまして本当にありがとうございました。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問