Common android tools and skills in Linux

Source: Internet
Author: User

After more than a year of work, I have summarized common android tools and skills in the Linux environment. On the one hand, we will consolidate our previous knowledge and share it with you. The tools and skills here may be useful to you.

I. Terminal
1. Create a terminal Ctrl-alt-T
2. Create a new terminal window Ctrl-shift-T

2. Install/Update Software
$ Sudo apt-cache search XXX search for Software containing xxx

$ Sudo apt-Get Update update source

$ Sudo apt-Get upgrade software

$ Sudo apt-Get install (remove/autoremove) xxx install (uninstall/uninstall automatically) xxx Software

$ Sudo RM/var/lib/APT/lists/lock release apt-get lock

3. Compile
1. Compile the source code
$ CD source code path
$. Source code path/build/envsetup. h
$ Make

2. compile the project
$ CD source code path
$. Source code path/build/envsetup. h
$ CD project path
$ Mm

Android kernel Encoding Error solution for 3.64-bit Systems
Http://blog.csdn.net/zyc13701469860/archive/2011/02/25/6207522.aspx

Iv. ADB
1. ADB command
ADB push <local> <remote>-copy file/DIR to Device

ADB pull <remote> [<local>]-copy file/DIR from Device

ADB shell-run remote shell interactively

ADB shell <command>-run remote shell command

Adb emu <command>-run emulator Console Command

ADB logcat [<filter-spec>]-view device log

ADB install [-L] [-R] [-S] <File>-push this package file to the device and install it

('-L' means forward-lock the app)

('-R' means reinstall the app, keeping its data)

('-S' means install on SD card instead of internal storage)

ADB uninstall [-K] <package>-Remove this app package from the device

('-K' means keep the data and cache Directories)

ADB start-server-ensure that there is a server running

ADB kill-server-kill the server if it is running

ADB devices-Restart Device

2. if the device is disconnected, restart it using the following methods:
Sudo ADB kill-Server
Sudo ADB Devices

3. Start the simulator on the terminal
$ Sudo CP Android SDK path/tools/emulator/usr/bin/
$ Emulator-AVD avdname [parameter 1 | parameter 2 |...]
$ Android-sdk-linux_x86/tools/emulator-AVD avd4.0-partition-size 1024-sdcard mysdcard. ISO"

4. The following situations occur during ADB push:
1. Out of memory-insufficient memory. The parameter-partition-size XXX is added to the terminal startup simulator. xxx indicates the memory size (MB)
2. Read-only -- the simulator folder is read-only and $ sudo ADB remount is used.
3. Not found: Method for disconnecting and restarting the device

5. display the log of the simulator/real machine on the terminal
$ ADB logcat -- General display
$ ADB logcat-V time -- output time
$ ADB logcat-V time | grep "XXX" -- output time and log containing the string xxx

6.64-bit system starts Android 3.0 Simulator
$ Sudo apt-Get ia32-libs needs to be installed

5. XP Virtual Machine startup Solution
$ Sudo invoke-RCID virtualbox-ose stop
$ Sudo invoke-RCID virtualbox-ose start

Vi. VIM + taglist + cs.pdf
1. vimrc

"Case-insensitive" set ignorecase "removes the annoying VI consistency mode, avoid bugs and limitations in earlier versions: "set nocompatible" Use mouse everywhere "set mouse = ni" display row number "set nu" detect file type "filetype on" load for specific file types related indent file filetype indent on "records the number of historical rows" set history = 1000 "background black" Set background = Dark "syntax High Brightness Display" syntax on "Enable Automatic indent" set cindent" when writing the Code in the following two lines, it is useful in the format pair. "" In the first line, VIM uses automatic start, that is, applies the format of the current row to the next line. "" In the second line, based on the preceding set-up format, you can intelligently select the set-up mode, which is useful for writing similar to C Language "" set autoindent set smarti Ndent "supports C/C ++ indentation" set Cin "to facilitate the use of taglist" NMAP <F2>: tlist <CR> let tlist_show_one_file = 1let tlist_exit_onlywindow = 1let tlist_use_right_window = 1 "the first line sets the tab key to 4 spaces, the second row is set to use four spaces when the lines are staggered. "Set tabstop = 4 set shiftwidth = 4" sets the matching mode, similarly, when a left brace is entered, the right brace "set showmatch" will be matched to remove the toolbar "set guioptions-= t" in the vim GUI version. When Vim is edited, if a command error occurs, a sound will be triggered. This setting removes the noise "set VB t_vb =" during the editing process, show the status line "set ruler" at the cursor position in the lower right corner to find matching "set HL S "set highlighted search set hlsearch" is very convenient to query. To search for the book word, the first word starting with B is automatically found when/B is entered, when you enter/Bo, the first word starting with Bo is automatically found, and so on. Using this setting, you can quickly find the answer, when you find the matching word "", do not forget to press ENTER "set incsearch" to modify a file and then back up it automatically. The backup file name is the original file name plus "~ "Suffix" set backup ": Keep the Last Exit position autocmd bufreadpost * \ If line (" '\ "")> 0 & line ("'\"") <= line ("{1} quot;) | \ exe" normal G' \ "" | \ endif "indent by C language format set cindent" inherits the indent of the previous line, it is especially suitable for multi-line comments set autoindent "show parentheses match set showmatch". The display time of matching parentheses is 1 (in the unit of 10 s) set matchtime = 1 "the command line in enhancement mode automatically completes the operation set wildmenu". Do not generate a swap file, when the buffer is discarded, hide it setlocal noswapfileset bufhidden = hide """"""""""""""""""""""""""" "cscope setting" """""""""""""""""""""""""""""""""""""""" "If has (" CSAs ") set csprg =/usr/bin/cs1_set CSTO = 1 Set CST set nocsverb "add any database in current directory if filereadable (" cscope. out ") CS add cscope. out endif set csverbendifnmap <c-@> S: CS find S <C-R> = expand ("<cword>") <CR> NMAP <c-@> G: CS find G <C-R> = expand ("<cword>") <CR> NMAP <c-@> C: CS find C <C-R> = expand ("<cword>") <CR> NMAP <c-@> T: CS find t <C-R> = expand ("<cword>") <CR> NMAP <c-@> E: CS find e <C-R> = expand ("<cword>") <CR> NMAP <c-@> F: CS find F <C-R> = expand ("<cfile>") <CR> NMAP <c-@> I: CS find I ^ <C-R >=expand ("<cfile>") <CR >{1} lt; CR> NMAP <c-@> D: CS find d <C-R> = expand ("<cword>") <CR>

2. Create the index file used by csflood
Use the following command in the root directory where you need to browse the source code (for example, you want to use cssag to view the Linux source code:
#: Cs1_rbkq <press enter>
R indicates that all files in the subdirectories are indexed.
B indicates that cssag does not start its own user interface, but only creates a symbolic database.
Q: generate the cssag. In. Out and cssag. Po. out files to speed up the cssag index.
K does not search the/usr/include directory when generating the index file

VII. Eclipse (Linux)
1. Set smart match
Perferences-> JAVA-> editer-> content attist-> auto activation triggers for Java
You can set any number

8. Linux commands
1. Use back n to replace CD ../../../
1.1 write Goback. Sh
#! /Bin/bash
If [$ #! = 1]
Then
Echo "A Go Back dir number required ."
Exit 1
Fi
Newdir = 'echo ".. /"| awk-V num = $1 '{for (I = 1; I <= num; I ++) printf ($0 )}''
CD $ newdir

1.2 create a script
Myutil. Sh
Alias back = "Source ~ /Goback. Sh"

1.3 enter $. myutil. Sh on the terminal
Then, back n is used to return the n-layer directory.

9. Android
1. sqlite3 view the database
1.1 List all tables
. Table
1.2 View table structure
Select * From sqlite_master where type = "table ";
1.3 display title
. Head on
1.4android multimedia database location
/Data/COM. Android. providers. Media/databases/external. DB
Root permission required

2. Use System permissions (applicable to and using reflection to call the system class)
Compile the code in the source code
2.1 Add Android: shareduserid = "android. uid. system" to androidmanifast"
2.2 compile makefile
Just change the MAKEFILE file of another app.
3mm Compilation

10. Java Regular Expression
Regular Expression set for verifying numbers
Verification number: ^ [0-9] * $
Verify the n-digit number: ^ \ D {n} $
Verify at least N digits: ^ \ D {n,} $
Verify M-N digits: ^ \ D {m, n} $
Verify the number starting with zero or zero: ^ (0 | [1-9] [0-9] *) $
Verify the positive number of two decimal places: ^ [0-9] + (. [0-9] {2 })? $
Verify the positive number of 1-3 decimal places: ^ [0-9] + (. [0-9] {1, 3 })? $
Verify a non-zero positive integer: ^ \ +? [1-9] [0-9] * $
Verify a non-zero negative integer: ^ \-[1-9] [0-9] * $
Verify non-negative integer (positive integer + 0) ^ \ D + $
Verify non-positive integer (negative integer + 0) ^ (-\ D +) | (0 +) $
3 characters for verification: ^. {3} $
Verify a string consisting of 26 English letters: ^ [A-Za-Z] + $
Verify a string consisting of 26 uppercase letters: ^ [A-Z] + $
Verify a string consisting of 26 lower-case letters: ^ [A-Z] + $
Verify a string consisting of digits and 26 English letters: ^ [A-Za-z0-9] + $
Verify a string consisting of digits, 26 English letters, or underscores: ^ \ W + $
Verify User Password: ^ [A-Za-Z] \ W {5, 17} $ the correct format is: it must start with a letter and be between 6 and 18 characters. It can only contain characters, numbers, and underscores.
Check whether ^ % & ',; =? $ \ "And other characters: [^ % & ',; =? $ \ X22] +
Verify Chinese characters: ^ [\ 1-\ token], {0,} $
Verify email address: ^ \ W + [-+.] \ W +) * @ \ W + ([-.] \ W + )*\. \ W + ([-.] \ W +) * $
Verify interneturl: ^ http: // ([\ W-] + \.) + [\ W-] + (/[\ W -./? % & =] *)? $; ^ [A-Za-Z] +: // (W + (-W +) *) (. (W + (-W + )*))*(? S *)? $
Verification phone number: ^ (\ D {3, 4} \) | \ D {3, 4 }-)? \ D {7,8} $: -- the correct format is: XXXX-XXXXXXX, XXXX-XXXXXXXX, XXX-XXXXXXX, XXX-XXXXXXXX, xxxxxxx, XXXXXXXX.
Verify the ID card number (15 or 18 digits): ^ \ D {15} | \ D {} 18 $
12 months of verification: ^ (0? [1-9] | 1 [0-2]) $ the correct format is: "01"-"09" and "1" "12"
31 days of verification for a month: ^ (0? [1-9]) | (1 | 2) [0-9]) | 30 | 31) $ the correct format is: 01, 09, 1, 31.
Integer: ^ -? \ D + $
Non-negative floating point number (Positive floating point number + 0): ^ \ D + (\. \ D + )? $
Positive floating point number ^ ([0-9] + \. [0-9] * [1-9] [0-9] *) | ([0-9] * [1-9] [0-9] * \. [0-9] +) | ([0-9] * [1-9] [0-9] *) $
Non-Positive floating point number (negative floating point number + 0) ^ (-\ D + (\. \ D + )?) | (0 + (\. 0 + )?)) $
Negative floating point number ^ (-([0-9] + \. [0-9] * [1-9] [0-9] *) | ([0-9] * [1-9] [0-9] * \. [0-9] +) | ([0-9] * [1-9] [0-9] *) $
Floating Point Number ^ (-? \ D +) (\. \ D + )?

11. Use MTP to connect to Ubuntu android
1. Download and install mtpfs
2. sudo mtpfs-O allow_other/Media/MTP

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.