任務(wù)
- 配制環(huán)境
- 了解公司組織架構(gòu)
- 熟悉項(xiàng)目代碼
- 解決ANR問題
配制環(huán)境
公司用的是Deepin操作系統(tǒng)(是一個(gè)基于Debian的Linux操作系統(tǒng)), 之前公司用的是mint 18.0,所以用的還算順手
- 使用
uname -a
打印當(dāng)前系統(tǒng)相關(guān)信息
Linux android-PC 4.15.0-30deepin-generic #31 SMP Fri Nov 30 04:29:02 UTC 2018 x86_64 GNU/Linux
- adb 配制環(huán)境變量配制
$ vim .bashrc
打開文件较曼,在文件最下面添加下面配制
export ANDROID_HOME=/home/youruser/Android/sdk
export PATH="${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools" //注意這里是要以冒號(hào)分隔
-
安裝常用的工具
gvim磅崭,sublime,atom
$ sudo apt-get install subversion
$ sudo apt-get install git
Chrome安裝axure插件
原型圖都是用axure來做的,要用chrome打開生成的axure文件憔晒,就要安裝Axure RP Extension for Chrome這個(gè)插件svn使用
公司給了一個(gè)文檔地址和對(duì)應(yīng)的svn賬號(hào)
首先自己通過下面命令下載
$ svn checkout svn路徑 --username yourname //如果當(dāng)前登錄系統(tǒng)的名字和svn用戶名不一樣的時(shí)候,要指定相應(yīng)的用戶名
后面發(fā)現(xiàn)由于這個(gè)拉的是整個(gè)公司不同部門的所有的文檔淀散,下載了半個(gè)小時(shí)都沒有下載完棋傍,然后我就在網(wǎng)上搜索使用下面命令
$ svn checkout svn路徑 --username yourname --depth=empty //只checkout目錄,不包括內(nèi)容
- 郵箱配制
imap.mxhichina.com
smtp.mxhichina.com
項(xiàng)目結(jié)構(gòu)
使用阿里ARouter路由實(shí)現(xiàn)Android模塊化開發(fā)彻采,用到的庫有:
com.alibaba.android.arouter
com.tencent.smtt.sdk
com.taobao.sophix
com.tencent.bugly
airbnb.lottie
com.google.gson
ANR問題排查
項(xiàng)目用的是bugly來統(tǒng)計(jì)報(bào)錯(cuò)信息脖岛,最近發(fā)現(xiàn)很多ANR的問題,日記如下:
Android ANR問題原因分析(Reason: Input dispatching timed out (Waiting because no window has focus but there is a focused application that may eventually add a window when it finishes starting up.))
剛才有一處報(bào)錯(cuò)可以定位到具體的代碼颊亮,能過查看那個(gè)類涉及到的代碼柴梆,發(fā)現(xiàn)有三個(gè)問題會(huì)導(dǎo)致ANR
- 使用了
collections.sort
排列數(shù)組,數(shù)據(jù)量大會(huì)很耗時(shí) - ListView嵌套在ScrollView當(dāng)中终惑,導(dǎo)致ListView復(fù)用
- Adapter每一個(gè)item都有循環(huán)去查找绍在,數(shù)據(jù)量大會(huì)很耗時(shí)
Deeplin怎么安裝rpm軟件包
- 安裝alien,fakeroot
$ sudo apt-get install alien fakeroot
- 使用alien將rpm包轉(zhuǎn)為deb包
$ fakeroot alien name.rpm
- 安裝包
$ sudo dpkg -i name.deb
這里為什么要使用fakeroot?
fakeroot 可以用來模擬 root 權(quán)限, 在fakeroot環(huán)境中,操作文件就像使用root操作文件一樣。但是偿渡,實(shí)際上系統(tǒng)中文件的權(quán)限還是原來的權(quán)限臼寄。
Vim 復(fù)制內(nèi)容到系統(tǒng)剪切板
set clipboard=unnamed
“*y "+y
遇到的問題
- android git配制問題
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
fatal: unable to auto-detect email address (got 'Administrator@MS-201610130300.(none)')
解決:Android Studio 使用git config配制環(huán)境變量
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
- android 虛擬機(jī)啟動(dòng)失敗
Installation did not succeed.
The application could not be installed: INSTALL_FAILED_INSUFFICIENT_STORAGE
The device needs more free storage to install the application (extra space is needed in addition to APK size).s
The profiler was unable to parse the trace file. Please make sure the file selected is a valid trace
解決: 修改虛擬機(jī)內(nèi)存的大小
用到的命令
$ adb shell pm list packages | grep 包名
$ adb push 文件路徑 sdcard路徑
$ adb pull sdcard路徑 文件路徑
引用
Android Handler機(jī)制 - MessageQueue如何處理消息