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

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

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

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

Xcode

Xcodeはソフトウェア開発のための、Appleの統合開発環境です。Mac OSXに付随するかたちで配布されています。

Q&A

解決済

1回答

4162閲覧

Flutterで実機を導入しようとしたら、実機のみならずSimulatorでもbuildできなくなってしまった問題

flutter_labo

総合スコア110

Flutter

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

Xcode

Xcodeはソフトウェア開発のための、Appleの統合開発環境です。Mac OSXに付随するかたちで配布されています。

0グッド

0クリップ

投稿2020/06/13 10:09

Flutterで実機の導入を試みたのですが、実機で開いた時にアプリの画面が真っ白のまま動かなくなってしまったので
仕方なくSimulatorで開くことにしたのですが、ビルド時にエラーが発生しました

その後、podfileを消してみたり、いろいろしてみる内に完全にハマっっちゃいました。。
以下は、パソコンから実機の接続を切った後、Simulatorでアプリを起動してみた時の話です。

flutter doctor

[✓] Flutter (Channel beta, 1.18.0-11.1.pre, on Mac OS X 10.15.4 19E287, locale ja-JP) [✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3) [✓] Xcode - develop for iOS and macOS (Xcode 11.3.1) [✓] Android Studio (version 3.5) [✓] Connected device (1 available)

XcodeでRunしたときのエラーコードがこちらです

xcode

1'Flutter/Flutter.h' file not found

イメージ説明

そしてこちらがAndorid Studioにて表示されたエラーです。

flutter

1Warning! The 'flutter' tool you are currently running is from a different Flutter repository than the one last used by this package. The repository from which the 'flutter' tool is currently executing will be used instead. 2 running Flutter tool: /Users/自分の名前/flutter 3 previous reference : /Users/自分の名前/AndroidStudioProjects/flutter 4This can happen when you have multiple copies of flutter installed. Please check your system path to verify that you are running the expected version (run 'flutter --version' to see which flutter is on your path). 5 6Launching lib/main.dart on AOSP on IA Emulator in debug mode... 7Running Gradle task 'assembleDebug'... 8Warning! The 'flutter' tool you are currently running is from a different Flutter repository than the one last used by this package. The repository from which the 'flutter' tool is currently executing will be used instead. 9 running Flutter tool: /Users/自分の名前/flutter 10 previous reference : /Users/自分の名前/AndroidStudioProjects/flutter 11This can happen when you have multiple copies of flutter installed. Please check your system path to verify that you are running the expected version (run 'flutter --version' to see which flutter is on your path). 12 13 14Compiler message: 15../flutter/packages/flutter/lib/src/widgets/basic.dart:5157:9: Error: Type 'ui.TextHeightBehavior' not found. 16 final ui.TextHeightBehavior textHeightBehavior; 17 ^^^^^^^^^^^^^^^^^^^^^ 18../flutter/packages/flutter/lib/src/widgets/implicit_animations.dart:1593:9: Error: Type 'ui.TextHeightBehavior' not found. 19 final ui.TextHeightBehavior textHeightBehavior; 20 ^^^^^^^^^^^^^^^^^^^^^ 21../flutter/packages/flutter/lib/src/widgets/text.dart:149:9: Error: Type 'ui.TextHeightBehavior' not found. 22 final ui.TextHeightBehavior textHeightBehavior; 23 ^^^^^^^^^^^^^^^^^^^^^ 24../flutter/packages/flutter/lib/src/widgets/text.dart:432:9: Error: Type 'ui.TextHeightBehavior' not found. 25 final ui.TextHeightBehavior textHeightBehavior; 26flutter/packages/flutter/lib/src/painting/text_style.dart:1096:7: Error: No named parameter with the name 'textHeightBehavior'. 27 textHeightBehavior: textHeightBehavior, 28 ^^^^^^^^^^^^^^^^^^ 29org-dartlang-sdk:///flutter/lib/ui/text.dart:877:3: Context: Found this candidate, but the arguments don't match. 30 ParagraphStyle({ 31 ^^^^^^^^^^^^^^ 32Target kernel_snapshot failed: Exception: Errors during snapshot creation: null 33build failed. 34 35FAILURE: Build failed with an exception. 36 37* Where: 38Script '/Users/自分の名前/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 780 39 40* What went wrong: 41Execution failed for task ':app:compileFlutterBuildDebug'. 42> Process 'command '/Users/自分の名前/flutter/bin/flutter'' finished with non-zero exit value 1 43 44* Try: 45Run 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. 46 47* Get more help at https://help.gradle.org 48 49BUILD FAILED in 29s 50Finished with error: Gradle task assembleDebug failed with exit code 1

情報の補足はいくらでもさせていただくので、回答していただけると嬉しいです!

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

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

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

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

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

guest

回答1

0

ベストアンサー

遭遇したことのないエラーなのですが、、
Androidのエラーを見る限り、下記の対処法で改善したりしないでしょうか?
https://github.com/flutter/flutter/issues/10765#issuecomment-453720210

上記の対応を行い、iOSのエラーが改善されないようであれば下記の対処法も試す価値はありそうです。
https://github.com/flutter/flutter/issues/16036#issuecomment-378916342

投稿2020/06/14 02:13

Kapustin

総合スコア1186

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

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

flutter_labo

2020/06/15 09:47

ご回答ありがとうございます! flutter packages getをAndroidStudioのターミナルで試してみた結果が flutter packages get Running "flutter pub get" in xxxxxx_app... 0.8sとなり、 一応flutter cleanした後にrunしてみたのですがエラーは変わらずといった感じでした。 次も同じく、AndroidStudioで、pod updateとしてみたところ、 [!] No `Podfile' found in the project directory. というエラー文が出てしましました。 /Users/自分の名前/AndroidStudioProjects/アプリ名/ios/Podfile のところにPodfileが存在してるはずなのにどうしてなんでしょうか…。
Kapustin

2020/06/15 10:10

[!] No `Podfile' found in the project directory. こちらに関しては、Podファイルの存在するディレクトリで pod update を行っていない可能性があります。 ターミナルで ``` cd /Users/自分の名前/AndroidStudioProjects/アプリ名/ios pod update ``` とするとどうでしょうか?
flutter_labo

2020/06/15 12:11 編集

先ほどまでと違い、pod updateを実行しようとするところまではいけました!ありがとうございます。 pod updateした結果、このようなエラー文が表示されてしまいました ``` [!] Oh no, an error occurred. Search for existing GitHub issues similar to yours: https://github.com/CocoaPods/CocoaPods/search?q=undefined+method+%60size%27+for+nil%3ANilClass&type=Issues If none exists, create a ticket, with the template displayed above, on: https://github.com/CocoaPods/CocoaPods/issues/new Be sure to first read the contributing guide for details on how to properly submit a ticket: https://github.com/CocoaPods/CocoaPods/blob/master/CONTRIBUTING.md Don't forget to anonymize any private data! Looking for related issues on cocoapods/cocoapods... - NoMethodError - undefined method `size' for nil:NilClass https://github.com/CocoaPods/CocoaPods/issues/8377 [closed] [13 comments] 2 weeks ago - NoMethodError - undefined method `size' for nil:NilClass https://github.com/CocoaPods/CocoaPods/issues/9484 [closed] [9 comments] 14 Apr 2020 - pod install crashes https://github.com/CocoaPods/CocoaPods/issues/9654 [closed] [2 comments] 27 Mar 2020 and 4 more at: https://github.com/cocoapods/cocoapods/search?q=undefined%20method%20%60size%27%20for%20nil&type=Issues&utf8=✓ [!] Automatically assigning platform `iOS` with version `8.0` on target `Runner` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`. ``` そこで、こちらの記事(https://github.com/CocoaPods/CocoaPods/issues/8377#issuecomment-554915212)を手掛かりに進めに行ったところ、flutter upgradeをする必要がありそうだったのでやってみたところ ``` Your flutter checkout has local changes that would be erased by upgrading. If you want to keep these changes, it is recommended that you stash them via "git stash" or else commit the changes to a local branch. If it is okay to remove local changes, then re-run this command with --force. ``` というエラー文が出ました。 flutter upgrade --forceとしても、いいものなのでしょうか。(データの破損などが心配)
Kapustin

2020/06/15 12:36

何らかの操作で flutter自体のコード等に変更が加えられてしまったようですね。 意図して変更したものでなければ、flutter upgrade --force で強制的に修正した方が良いです。 それで挙動がおかしくなるようであれば、そのあと対応した方が良いかと思います。 (変更を残したいのであれば、コンフリクトしている部分を解決してマージするような面倒な操作が今後も必要になってくるかと思います) 経緯から推測するに、おそらく意図した変更ではないと思うので、これが元々のエラーの原因になっている可能性は高そうです。
flutter_labo

2020/06/15 13:53

丁寧なご回答本当にありがとうございます。。 flutter upgrade自体はうまく行ったのですが、やはりエラー内容は変わらずといった感じでした。 いろいろ試してみて、また何かわからないことがあれば質問させていただくかもしれませんm(_ _)m 他にも、これしたほうがいいのでは?っていうことがあれば教えていだけると嬉しいです!
Kapustin

2020/06/15 14:14

エラーで気になるのは、 Warning! The 'flutter' tool you are currently running is from a different Flutter repository than the one last used by this package. The repository from which the 'flutter' tool is currently executing will be used instead. running Flutter tool: /Users/自分の名前/flutter previous reference : /Users/自分の名前/AndroidStudioProjects/flutter flutterリポジトリが複数インストールされている場合に発生する可能性があると書かれているので、そのような操作をしていたりしませんか? 自分だったら、、という視点ですが、そもそもの開いているプロジェクトのパスが違ったり、下記の fulutter/bin へのパスを変えてしまったりしてないか疑います。 https://flutter.dev/docs/get-started/install/macos (そして時間が無題になると判断すれば、flutterを再度セットアップしているしていると思います。あまり良い回答ではないかもしれませんが笑)
flutter_labo

2020/06/16 00:22

なるほど。。良い回答じゃないなんてとんでもないです笑 本当に助かります。 そういえばなんですが、flutterを始めてすぐの頃、このアプリとは別にもう1つアプリを作ったのですが、 例えば最初に作ったアプリをアプリ1、2番目に作ったアプリをアプリ2とすると、アプリ1のプロジェクト内にアプリ2が入ってしまっていたことがありました。。 「ま、消せばいいか」と思い、普通にアプリ2を削除してことなきを得たはずだったのですが、(これまでは特に問題なかった)これが原因な気がしてなりません笑 もしくは、途中でbashからzshに変えてしまったのが原因なのか…。 プロジェクトのパスやflutter/binへのパスが間違っているかはどのように確認すればいいでしょうか?
flutter_labo

2020/06/16 09:33

やはりいらないプロジェクトのパスが違っていることが原因でした! パスの位置を正しくしたところ、無事解決いたしました。 丁寧に回答していただきありがとうございました!
Kapustin

2020/06/16 12:01

解決できてよかったです!
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.49%

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

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

質問する

関連した質問