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

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

網(wǎng)站百科

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

01 - Flutter環(huán)境搭建

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

[TOC]
寫(xiě)在最前面,想玩flutter最好有科學(xué)上網(wǎng)的梯子,否則被墻的整個(gè)人都暴躁了

下載SDK

在目標(biāo)目錄使用git拉取flutter的sdk

# 移動(dòng)到目標(biāo)目錄 cd ${HOME}/env # 拉取sdk git clone https://github.com/flutter/flutter.git 

環(huán)境變量配置

  • 需要提前配置好安卓開(kāi)發(fā)環(huán)境,可以提前配置好jdk,android sdk等環(huán)境變量

  • 需要配置flutter sdk的環(huán)境變量

  • 需要配置flutter的鏡像地址

    PUB_HOSTED_URL=https://pub.flutter-io.cn FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn 

.bash_profile的參考配置

# jdk begin JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home # jdk end # android sdk begin ANDROID_HOME=/Users/rexih/Library/Android/sdk ADB_HOME=/Users/rexih/Library/Android/sdk/platform-tools # android sdk end #android ndk begin NDK_HOME=/Users/rexih/Library/Android/sdk/ndk-bundle CMAKE_HOME=/Users/rexih/Library/Android/sdk/cmake/3.6.4111459 #android ndk end # flutter begin FLUTTER_HOME=/Users/rexih/env/flutter PUB_HOSTED_URL=https://pub.flutter-io.cn FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn # flutter end PATH=$FLUTTER_HOME/bin:$FLUTTER_HOME:$CMAKE_HOME/bin:$ANDROID_HOME/:$ANDROID_HOME/tools:$ADB_HOME:$NDK_HOME:$JAVA_HOME/bin:$PATH:. CLASSPATH=JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:. export JAVA_HOME export ANDROID_HOME export ADB_HOME export NDK_HOME export CMAKE_HOME export PATH export CLASSPATH export FLUTTER_HOME export PUB_HOSTED_URL export FLUTTER_STORAGE_BASE_URL 

Android Studio插件安裝

打開(kāi)as(本文使用的是3.2.1 stable)的plugin,下載插件Flutter,會(huì)自動(dòng)下載插件Dart,確保兩個(gè)插件勾選,重啟as

環(huán)境診斷與修復(fù)

flutter提供doctor指令幫助用戶診斷開(kāi)發(fā)環(huán)境是否可用,根據(jù)命令行里的診斷結(jié)果逐步修復(fù)即可

  • 第一次運(yùn)行會(huì)自動(dòng)下載Dart SDK

    Downloading Dart SDK from Flutter engine# ... Building flutter tool... # ... Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this source! # ... Doctor summary (to see all details, run flutter doctor -v): # ... 
  • 診斷結(jié)果會(huì)告知去設(shè)置Android SDK的環(huán)境變量

  • 診斷結(jié)果會(huì)告知運(yùn)行flutter doctor --android-licenses通過(guò)licenses以使用

    [!] Android toolchain - develop for Android devices (Android SDK version 28.0.3) ! Some Android licenses not accepted.To resolve this, run: flutter doctor --android-licenses 
  • 診斷結(jié)果會(huì)告知安裝AS插

    [!] Android Studio (version 3.2) ? Flutter plugin not installed; this adds Flutter specific functionality. ? Dart plugin not installed; this adds Dart specific functionality. 
  • 診斷結(jié)果會(huì)告知運(yùn)行設(shè)備情況

    [!] Connected device ! No devices available 
  • 診斷結(jié)果會(huì)告知idea和iOS的開(kāi)發(fā)環(huán)境的可用性

設(shè)置gradle及代碼倉(cāng)庫(kù)地址

  • 國(guó)內(nèi)被墻的很嚴(yán)重。gradle下載太慢了。建議先下載好gradle的對(duì)應(yīng)版本,放置到本地gradle倉(cāng)庫(kù)里,以加快構(gòu)建速度。(移動(dòng)寬帶直接下載也挺慢的)

  • 手動(dòng)下載gradle對(duì)應(yīng)版本。例如下載gradle 4.10.2 地址:https://downloads.gradle.org/distributions/gradle-4.10.2-all.zip,下載完成后放到${HOME}/.gradle/wrapper/dists/gradle-4.10.2-all/9fahxiiecdb76a5g3aw9oi8rv,解壓,修改文件鎖gradle-4.10.2-all.zip.ok

  • 使用鏡像替代flutter的腳本倉(cāng)庫(kù)。找到flutter sdk的根目錄,打開(kāi)packages/flutter_tools/gradle/flutter.gradle,修改倉(cāng)庫(kù)地址

    buildscript { repositories { maven { url "https://maven.aliyun.com/repository/google" } maven { url "https://maven.aliyun.com/repository/jcenter" } maven { url "http://maven.aliyun.com/nexus/content/groups/public" } // google() // jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.2.1' } } 

    ?

創(chuàng)建Flutter項(xiàng)目

  • 配置好開(kāi)發(fā)環(huán)境后,AS新建項(xiàng)目時(shí)會(huì)增加新的創(chuàng)建選項(xiàng)Start a new Flutter project

  • 設(shè)置項(xiàng)目名稱時(shí),必須遵守其命名規(guī)范,小寫(xiě)加_下劃線,否則會(huì)提示

    Invalid project name: 'T' - must be a valid Dart package name (lower_case_with_underscores) 
  • 點(diǎn)擊播放鍵編譯運(yùn)行項(xiàng)目

熱重載

修改后,不點(diǎn)擊播放鍵,直接ctrl+s保存一下源文件,發(fā)現(xiàn)設(shè)備上直接同步了修改

  1. 要查看您的更改, 只需調(diào)用 Save All (cmd-s / ctrl-s), 或點(diǎn)擊 熱重載按鈕 (帶有閃電??圖標(biāo)的按鈕).

flutter相關(guān)指令

查看連接設(shè)備

flutter devices1 connected device:Android SDK built for x86 ? emulator-5554 ? android-x86 ? Android 9 (API 28) (emulator) 

切換flutter到Stable版本

# 查看可用版本 flutter channel # 切換到stable版本 flutter channel stable # 切換版本后再次調(diào)用flutter指令會(huì)重新配置開(kāi)發(fā)環(huán)境 flutter 

其他

離線下載flutter和dart插件

9212-flutter
6351-dart

卡在Creating Flutter Project

查看項(xiàng)目目錄下是否已經(jīng)生成項(xiàng)目文件,如果有,強(qiáng)制關(guān)閉as進(jìn)程,重啟后打開(kāi)此項(xiàng)目

flutter packages get運(yùn)行時(shí)提示等待另一個(gè)flutter指令

Waiting for another flutter command to release the startup lock…

  1. 打開(kāi)flutter的安裝目錄/bin/cache/
  2. 刪除lockfile文件
  3. 刪除不掉則強(qiáng)制退出Dart.exe再刪除
  4. 重啟AndroidStudio

參見(jiàn)issues 7768

Resolving dependencies...

改android里build.gradle腳本的倉(cāng)庫(kù)源

buildscript { repositories { maven { url 'https://maven.aliyun.com/repository/google' } maven { url 'https://maven.aliyun.com/repository/jcenter' } maven { url 'http://maven.aliyun.com/nexus/content/groups/public' } //google() //jcenter() }dependencies { classpath 'com.android.tools.build:gradle:3.2.1' } }allprojects { repositories { maven { url 'https://maven.aliyun.com/repository/google' } maven { url 'https://maven.aliyun.com/repository/jcenter' } maven { url 'http://maven.aliyun.com/nexus/content/groups/public' } //google() //jcenter() } } 

本頁(yè)內(nèi)容由塔燈網(wǎng)絡(luò)科技有限公司通過(guò)網(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://jstctz.cn/18161.html
相關(guān)APP開(kāi)發(fā)
 八年  行業(yè)經(jīng)驗(yàn)

多一份參考,總有益處

聯(lián)系深圳網(wǎng)站公司塔燈網(wǎng)絡(luò),免費(fèi)獲得網(wǎng)站建設(shè)方案及報(bào)價(jià)

咨詢相關(guān)問(wèn)題或預(yù)約面談,可以通過(guò)以下方式與我們聯(lián)系

業(yè)務(wù)熱線:余經(jīng)理:13699882642

Copyright ? 2013-2018 Tadeng NetWork Technology Co., LTD. All Rights Reserved.