久久不射电影院,秋霞免费乱理伦片在线观看,欧美天堂视频,天天躁夜夜躁

歡迎您光臨深圳塔燈網(wǎng)絡科技有限公司!
電話圖標 余先生:13699882642

網(wǎng)站百科

為您解碼網(wǎng)站建設的點點滴滴

Flutter 環(huán)境配置與問題詳解

發(fā)表日期:2018-11 文章編輯:小燈 瀏覽次數(shù):2517

系統(tǒng)要求

  • 有能訪問外網(wǎng)的 VPN
  • macOS 64bit
  • Xcode 或者 Android Studio,或者兩者都有
  • 命令行工具:bash, mkdir, rm, git, curl, unzip

下載SDK

  1. 下載最新的 flutter SDK
  2. 把壓縮包放到你喜歡的地方,比如,Documents 目錄下
  3. 雙擊解壓縮,或通過命令:unzip ~/Documents/下載下來的包-beta.zip

添加 flutter 命令

解壓縮后,不要急著進入 flutter 文件夾,還停留在 Documents 文件目錄下(或者執(zhí)行 cd ~/Documents 切到這個目錄),然后執(zhí)行下面的命令:

$ export PATH=$PATH:`pwd`/flutter/bin 

有了這一步,可以避免這個問題: command not found: flutter

檢查環(huán)境依賴

執(zhí)行下面命令來檢測本機環(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) 

顯示叉號 ? 的,表示相應的工具沒有安裝。其中比較重要的兩大開發(fā)工具是:XcodeAndroid Statudio。

如果這兩個沒有安裝,需要根據(jù)你的開發(fā)者身份,安裝對應的開發(fā)工具

部署 iOS 環(huán)境

  1. 首先需要安裝 Xcode,最好是最新版本的
  2. 啟動 Xcode,同意它的 license 等(適用于新裝Xcode)
  3. Xcode command-line 指定要使用的 Xcode 版本:
$ sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer 
  1. 選擇 iPhone 5s 或之后版本的模擬器,然后執(zhí)行:
$ open -a Simulator 
  1. 再執(zhí)行下面的部署命令:
$ brew update $ brew install --HEAD usbmuxd $ brew link usbmuxd $ brew install --HEAD libimobiledevice $ brew install ideviceinstaller ios-deploy cocoapods $ pod setup 

運行 Flutter 項目

進入某個 flutter 項目目錄

$ cd ~/Documents/flutter/examples/hello_world 

執(zhí)行命令,安裝 hello_world 到模擬器:

$ flutter run 

運行一會后,模擬器已經(jīng)安裝了hello_world,但并沒有launch。也許會報錯:

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 的另一個問題:

根據(jù) $(PRODUCT_BUNDLE_IDENTIFIER) 不能成功的launch 模擬器

解決方法是:

  • Xcode打開 hello-world 項目
  • 找到 info.plist
  • 修改 Bundle identifier 的值為 io.flutter.examples.hello-world

再次執(zhí)行 flutter run. 模擬器成功 launch.

部署 Android

  1. 下載安裝 Android Studio.
  2. 啟動 Android Studio,執(zhí)行 “Android Studio Setup Wizard”
  3. 安卓設備啟用 Developer optionsUSB debugging. 這個文檔有詳細說明 Android documentation
  4. 把設備連接到電腦,執(zhí)行命令 flutter devices
  5. 啟動應用程序 flutter run

Android 模擬器

  1. 啟用 VM acceleration .

  2. Launch Android Studio ->Tools -> Android -> AVD Manager 并選擇 Create Virtual Device.

  3. 選擇一個設備并選擇 Next

  4. 為你要模擬的 Android 版本選擇一個或多個系統(tǒng)鏡像,然后選擇 Next. 建議使用 x86x86_64 鏡像 .

  5. Emulated Performance下, 選擇 Hardware - GLES 2.0 啟用 硬件加速.

  6. 驗證AVD配置是否正確,選擇 Finish。上述步驟的詳細信息,請參閱 Managing AVDs.

  7. Android Virtual Device Manager中, 點擊 Run 啟動模擬器

  8. 運行 flutter run . 可以看到連接的設備名稱是 Android SDK built for <x86or其他型號>

至此,Flutter 的環(huán)境部署就結束了。


本頁內(nèi)容由塔燈網(wǎng)絡科技有限公司通過網(wǎng)絡收集編輯所得,所有資料僅供用戶學習參考,本站不擁有所有權,如您認為本網(wǎng)頁中由涉嫌抄襲的內(nèi)容,請及時與我們聯(lián)系,并提供相關證據(jù),工作人員會在5工作日內(nèi)聯(lián)系您,一經(jīng)查實,本站立刻刪除侵權內(nèi)容。本文鏈接:http://www.webpost.com.cn/18055.html
相關APP開發(fā)