最近公司打算作一個app 咱們的android 打算採用新技術 ,因此我也投入了學習的大部隊中html
首先 學習react-native 他是幹什麼的 咱們一直知道 安卓和IOS不能互通,因此在開發app的時候,須要一我的開發IOS,一我的開發安卓。而這個react-native 就是一個在安卓和IOS能夠使用共通的js的前端框架 前端
1.第一步 安裝環境react
對於沒有開發過app的我來講 IOS和android的環境 都沒有裝過 包括一些編譯工具 模擬器等android
這是一個配置開發環境的過程 我也是按照這個步驟 配置的網址 ios
https://reactnative.cn/docs/0.36/getting-started.html#contentgit
要分別按照 步驟安裝開發環境github
ios的開發環境 比較好配置 編譯工具 直接從appstore 下載便可 而後就能夠運行 (模擬器第一次啓動比較慢)shell
android 的開發環境配置就比較複雜了npm
按照步驟一步步配置 到安裝android 工具 android studio 之後 按照 步驟 安裝 vim
<1.會報一個 sdk的錯誤 能夠先跳過 這個 之後在進行配置
<2.當不使用studio的模擬器 使用 下圖的模擬器 的時候
須要在進行一次配置
<3.ANDROID_HOME環境變量 配置環境變量的時候
.bash_profile
.bashrc
.zshrc
這三個 文件 須要配置
這幾個文件 默認系統是隱藏的
能夠經過 在命令行輸入這段代碼 來進行顯示隱藏
顯示隱藏文件 defaults write com.apple.finder AppleShowAllFiles -bool true osascript -e 'tell application "Finder" to quit' 不顯示隱藏文件 defaults write com.apple.finder AppleShowAllFiles -bool false osascript -e 'tell application "Finder" to quit'
下面是個人三個文件的配置 並不適用於每一個人的配置 寫在這裏 記錄一下環境配置的步驟 之後配置的時候 參考錯誤
在 .bash_profile 中加入
# User configuration
source ~/.bash_profile
source ~/.bashrc
.bashrc 中
export ANDROID_HOME=~/Library/Android/sdk #export PATH=${PATH}:~/Library/Android/sdk/platform-tools export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools export PATH=/usr/local/bin/brew:$PATH export PATH=/usr/local/opt/icu4c/bin:$PATH
.zshrc 中
# If you come from bash you might have to change your $PATH. # export PATH=$HOME/bin:/usr/local/bin:$PATH # Path to your oh-my-zsh installation. export ZSH=$HOME/.oh-my-zsh # Set name of the theme to load. Optionally, if you set this to "random" # it'll load a random theme each time that oh-my-zsh is loaded. # See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes ZSH_THEME="robbyrussell" # Set list of themes to load # Setting this variable when ZSH_THEME=random # cause zsh load theme from this variable instead of # looking in ~/.oh-my-zsh/themes/ # An empty array have no effect # ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" ) # Uncomment the following line to use case-sensitive completion. # CASE_SENSITIVE="true" # Uncomment the following line to use hyphen-insensitive completion. Case # sensitive completion must be off. _ and - will be interchangeable. # HYPHEN_INSENSITIVE="true" # Uncomment the following line to disable bi-weekly auto-update checks. # DISABLE_AUTO_UPDATE="true" # Uncomment the following line to change how often to auto-update (in days). # export UPDATE_ZSH_DAYS=13 # Uncomment the following line to disable colors in ls. # DISABLE_LS_COLORS="true" # Uncomment the following line to disable auto-setting terminal title. # DISABLE_AUTO_TITLE="true" # Uncomment the following line to enable command auto-correction. # ENABLE_CORRECTION="true" # Uncomment the following line to display red dots whilst waiting for completion. # COMPLETION_WAITING_DOTS="true" # Uncomment the following line if you want to disable marking untracked files # under VCS as dirty. This makes repository status check for large repositories # much, much faster. # DISABLE_UNTRACKED_FILES_DIRTY="true" # Uncomment the following line if you want to change the command execution time # stamp shown in the history command output. # The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" # HIST_STAMPS="mm/dd/yyyy" # Would you like to use another custom folder than $ZSH/custom? # ZSH_CUSTOM=/path/to/new-custom-folder # Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*) # Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ # Example format: plugins=(rails git textmate ruby lighthouse) # Add wisely, as too many plugins slow down shell startup. plugins=( git ) source $ZSH/oh-my-zsh.sh # User configuration source ~/.bash_profile source ~/.bashrc # export MANPATH="/usr/local/man:$MANPATH" # You may need to manually set your language environment # export LANG=en_US.UTF-8 # Preferred editor for local and remote sessions # if [[ -n $SSH_CONNECTION ]]; then # export EDITOR='vim' # else # export EDITOR='mvim' # fi # Compilation flags # export ARCHFLAGS="-arch x86_64" # ssh # export SSH_KEY_PATH="~/.ssh/rsa_id" #yarn export PATH="$PATH:$HOME/.yarn/bin" #electron #ELECTRON_MIRROR="https://npm.taobao.org/mirrors/electron/" # Set personal aliases, overriding those provided by oh-my-zsh libs, # plugins, and themes. Aliases can be placed here, though oh-my-zsh # users are encouraged to define aliases within the ZSH_CUSTOM folder. # For a full list of active aliases, run `alias`. # # Example aliases # alias zshconfig="mate ~/.zshrc" # alias ohmyzsh="mate ~/.oh-my-zsh"
命令行 檢查一下版本
CMCC-AUTO-GT:~ tingguo$ adb Android Debug Bridge version 1.0.40
安卓的模擬器 開啓效果 以後 在ws中修改代碼之後 在模擬器中 r+r 便可 刷新 查看效果
未完。。。