【发布时间】:2020-11-01 00:54:44
【问题描述】:
我是 iOS 开发新手,一开始就遇到了这个问题: 当我尝试运行我的 hello world 应用程序时,我得到了 xcodebuild 失败(我只写了最后几行,因为它太长了):
81 errors generated.
<unknown>:0: error: failed to emit precompiled header '/Users/mehec/Library/Developer/Xcode/DerivedData/Runner-cssmbpuzzkyjvpfghedbpvdhbbmr/Build/Intermediates.noindex/PrecompiledHeaders/Runner-Bridging-Header-swift_2PXLF604USZTM-clang_KLU4EDN5EN1U.pch' for bridging header '/Users/mehec/Desktop/bgp/learn_flutter_0_test/ios/Runner/Runner-Bridging-Header.h'
<unknown>:0: error: generate-pch command failed with exit code 1 (use -v to see invocation)
note: Using new build system
note: Planning build
note: Constructing build description
然后我尝试在 xcode 中构建和运行,一切都很好。
我尝试过flutter clean和flutter upgrade,甚至创建了一个新项目但没有效果
我使用的是 macOS 10.14.6、IntelliJ Idea 2020.1、Flutter 1.17.5 和 1.19.0、Xcode 11.3.1
main.dart 中的代码:
import 'package:flutter/material.dart';
void main() {
runApp(Center(
child: Text(
"hello world",
textDirection: TextDirection.rtl,
),
));
}
扑扑医生:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, 1.19.0-4.3.pre, on Mac OS X 10.14.6 18G5033, locale en-US)
[✗] Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).
If the Android SDK has been installed to a custom location, set ANDROID_SDK_ROOT to that location.
You may also want to add it to your PATH environment variable.
[✓] Xcode - develop for iOS and macOS (Xcode 11.3.1)
[!] Android Studio (not installed)
[✓] IntelliJ IDEA Ultimate Edition (version 2020.1.3)
[✓] Connected device (1 available)
! Doctor found issues in 2 categories.
谢谢!
【问题讨论】: