国产亚洲欧美人成在线,免费视频爱爱太爽了无码,日本免费一区二区三区高清视频 ,国产真实伦对白精彩视频

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

網(wǎng)站百科

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

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

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

系統(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 命令

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

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

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

檢查環(huán)境依賴

執(zhí)行下面命令來檢測(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)的工具沒有安裝。其中比較重要的兩大開發(fā)工具是:XcodeAndroid Statudio。

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

部署 iOS 環(huán)境

  1. 首先需要安裝 Xcode,最好是最新版本的
  2. 啟動(dòng) 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 

運(yùn)行 Flutter 項(xiàng)目

進(jìn)入某個(gè) flutter 項(xiàng)目目錄

$ cd ~/Documents/flutter/examples/hello_world 

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

$ flutter run 

運(yùn)行一會(huì)后,模擬器已經(jīng)安裝了hello_world,但并沒有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è)問題:

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

解決方法是:

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

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

部署 Android

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

Android 模擬器

  1. 啟用 VM acceleration .

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

  3. 選擇一個(gè)設(shè)備并選擇 Next

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

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

  6. 驗(yàn)證AVD配置是否正確,選擇 Finish。上述步驟的詳細(xì)信息,請(qǐng)參閱 Managing AVDs.

  7. Android Virtual Device Manager中, 點(diǎn)擊 Run 啟動(dòng)模擬器

  8. 運(yùn)行 flutter run . 可以看到連接的設(shè)備名稱是 Android SDK built for <x86or其他型號(hào)>

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


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