為您解碼網(wǎng)站建設(shè)的點(diǎn)點(diǎn)滴滴
發(fā)表日期:2018-11 文章編輯:小燈 瀏覽次數(shù):2149
bash, mkdir, rm, git, curl, unzip
Documents
目錄下unzip ~/Documents/下載下來(lái)的包-beta.zip
flutter
命令解壓縮后,不要急著進(jìn)入 flutter
文件夾,還停留在 Documents
文件目錄下(或者執(zhí)行 cd ~/Documents
切到這個(gè)目錄),然后執(zhí)行下面的命令:
$ export PATH=$PATH:`pwd`/flutter/bin
有了這一步,可以避免這個(gè)問(wèn)題: command not found: flutter
執(zhí)行下面命令來(lái)檢測(cè)本機(jī)環(huán)境依賴
$ flutter doctor
輸出如下:
[?] Flutter (Channel beta, v0.11.3, on Mac OS X 10.14 18A391, locale zh-Hans-CN) [?] 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.io/setup/#android-setup for detailed instructions). If Android SDK has been installed to a custom location, set $ANDROID_HOME to that location. You may also want to add it to your PATH environment variable.[!] iOS toolchain - develop for iOS devices (Xcode 9.4.1) ? libimobiledevice and ideviceinstaller are not installed. To install with Brew, run: brew update brew install --HEAD usbmuxd brew link usbmuxd brew install --HEAD libimobiledevice brew install ideviceinstaller ? ios-deploy not installed. To install with Brew: brew install ios-deploy [!] Android Studio (not installed) [?] VS Code (version 1.29.0) [?] Connected device (2 available)
顯示叉號(hào) ?
的,表示相應(yīng)的工具沒(méi)有安裝。其中比較重要的兩大開(kāi)發(fā)工具是:Xcode
和 Android Statudio
。
如果這兩個(gè)沒(méi)有安裝,需要根據(jù)你的開(kāi)發(fā)者身份,安裝對(duì)應(yīng)的開(kāi)發(fā)工具
Xcode
,最好是最新版本的Xcode
,同意它的 license
等(適用于新裝Xcode
)Xcode command-line
指定要使用的 Xcode
版本:$ sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
iPhone 5s
或之后版本的模擬器,然后執(zhí)行:$ open -a Simulator
$ brew update $ brew install --HEAD usbmuxd $ brew link usbmuxd $ brew install --HEAD libimobiledevice $ brew install ideviceinstaller ios-deploy cocoapods $ pod setup
進(jìn)入某個(gè) flutter
項(xiàng)目目錄
$ cd ~/Documents/flutter/examples/hello_world
執(zhí)行命令,安裝 hello_world
到模擬器:
$ flutter run
運(yùn)行一會(huì)后,模擬器已經(jīng)安裝了hello_world
,但并沒(méi)有launch
。也許會(huì)報(bào)錯(cuò):
ProcessException: Process "/usr/bin/xcrun" exited abnormally: "io.flutter.examples.hello-world": -1An error was encountered processing the command (domain=FBSOpenApplicationServiceErrorDomain, code=1): The request to open ""io.flutter.examples.hello-world"" failed. The request was denied by service delegate (SBMainWorkspace) for reason: NotFound ("Application ""io.flutter.examples.hello-world"" is unknown to FrontBoard"). Underlying error (domain=FBSOpenApplicationErrorDomain, code=4): The operation couldn’t be completed. Application ""io.flutter.examples.hello-world"" is unknown to FrontBoard. Application ""io.flutter.examples.hello-world"" is unknown to FrontBoard. Command: /usr/bin/xcrun simctl launch 4B7B9269-47FA-47B6-8096-17AB675A3E4F "io.flutter.examples.hello-world" --enable-dart-profiling --enable-checked-mode --observatory-port=0 Error launching application on iPhone 5s.
這里暴露出了 flutter
的另一個(gè)問(wèn)題:
根據(jù) $(PRODUCT_BUNDLE_IDENTIFIER)
不能成功的launch
模擬器
解決方法是:
Xcode
打開(kāi) hello-world
項(xiàng)目info.plist
Bundle identifier
的值為 io.flutter.examples.hello-world
再次執(zhí)行 flutter run
. 模擬器成功 launch
.
Android Studio
,執(zhí)行 “Android Studio Setup Wizard”
Developer options
和 USB debugging
. 這個(gè)文檔有詳細(xì)說(shuō)明 Android documentation flutter devices
flutter run
啟用 VM acceleration .
Launch Android Studio ->Tools -> Android -> AVD Manager
并選擇 Create Virtual Device
.
選擇一個(gè)設(shè)備并選擇 Next
為你要模擬的 Android
版本選擇一個(gè)或多個(gè)系統(tǒng)鏡像,然后選擇 Next
. 建議使用 x86
或 x86_64
鏡像 .
在 Emulated Performance下
, 選擇 Hardware - GLES 2.0
啟用 硬件加速.
驗(yàn)證AVD配置是否正確,選擇 Finish
。上述步驟的詳細(xì)信息,請(qǐng)參閱 Managing AVDs.
在 Android Virtual Device Manager
中, 點(diǎn)擊 Run
啟動(dòng)模擬器
運(yùn)行 flutter run
. 可以看到連接的設(shè)備名稱是 Android SDK built for <x86or其他型號(hào)>
至此,Flutter
的環(huán)境部署就結(jié)束了。
日期:2018-10 瀏覽次數(shù):7557
日期:2018-12 瀏覽次數(shù):4642
日期:2018-07 瀏覽次數(shù):5156
日期:2018-12 瀏覽次數(shù):4430
日期:2018-09 瀏覽次數(shù):5793
日期:2018-12 瀏覽次數(shù):10215
日期:2018-11 瀏覽次數(shù):5126
日期:2018-07 瀏覽次數(shù):4869
日期:2018-05 瀏覽次數(shù):5130
日期:2018-12 瀏覽次數(shù):4600
日期:2018-10 瀏覽次數(shù):5406
日期:2018-12 瀏覽次數(shù):6475
日期:2018-11 瀏覽次數(shù):4727
日期:2018-08 瀏覽次數(shù):4885
日期:2018-11 瀏覽次數(shù):13037
日期:2018-09 瀏覽次數(shù):5896
日期:2018-12 瀏覽次數(shù):5110
日期:2018-10 瀏覽次數(shù):4455
日期:2018-11 瀏覽次數(shù):4814
日期:2018-12 瀏覽次數(shù):6334
日期:2018-06 瀏覽次數(shù):4277
日期:2018-08 瀏覽次數(shù):5721
日期:2018-10 瀏覽次數(shù):4712
日期:2018-12 瀏覽次數(shù):4833
日期:2018-07 瀏覽次數(shù):4645
日期:2018-12 瀏覽次數(shù):4816
日期:2018-06 瀏覽次數(shù):4647
日期:2018-11 瀏覽次數(shù):4631
日期:2018-12 瀏覽次數(shù):4570
日期:2018-12 瀏覽次數(shù):5547
Copyright ? 2013-2018 Tadeng NetWork Technology Co., LTD. All Rights Reserved.