标签:获取 开发技术 工程文件 mpi 通讯 错误 ima workplace 下载
作者:郭孝星
微博:郭孝星的新浪微博
邮箱:allenwells@163.com
博客:http://blog.csdn.net/allenwells
github:https://github.com/AllenWell
AVD管理相关命令例如以下所看到的:
SDK管理相关命令例如以下所看到的:
当我们创建一个AVD时。系统会自己主动创建虚拟存储卡,假设我们想单独创建虚拟存储卡,能够使用命令mksdcard。
命令mksdcard语法格式例如以下所看到的:
mksdcard [-l label] <size> <file>
举例
创建一个60MB的SD卡,并将其镜像保存到D:\sdcard.img。
mksdcard 64M D:\sdcard.img
ADB(Android Debug Bridge)是有Google官方推出的调试工具,借助该工具能够管理Android设备或模拟器的状态。进行系统升级、应用管理等操作。
ADB的工作原理是监听Socket TCP5544端口的方式让IDE或DOS和Qemu进行通信。进而控制设备的状态。
1 显示系统中所有Android平台
android list targets
2 显示系统中所有AVD
android list avd
3 创建AVD
android create avd --name 名称 --target 平台编号
4 启动AVD
emulator -avd 名称 -sdcard ~/名称.img (-skin 1280x800)
5 删除AVD
android delete avd --name 名称
6 搜索模拟器/设备的实例。取得当前执行的模拟器/设备的实例的列表及每一个实例的状态
adb devices
7 获取设备的ID和序列号
adb get-product
adb get-serialno
1 安装APK
adb install -r 应用程序.apk
2 缷载apk包
adb shell
cd data/app
rm apk包
exit
adb uninstall apk包的主包名
adb install -r apk包
3 删除系统应用
adb remount (又一次挂载系统分区,使系统分区又一次可写)
adb shell
cd system/app
rm *.apk
4 启动Activity
adb shell am start -n 包名/包名+类名(-n 类名,-a action,-d date,-m MIME-TYPE,-c category,-e 扩展数据等)。
5 启动SDK,文档,实例下载管理器
android
1 获取模拟器中的文件
adb pull <remote> <local>
从设备或模拟器上复制一个文件或文件夹:
adb pull <source> <destination></destination></source>
比如:
adb pull /addroid/lib/libwebcore.so
2 向模拟器中写文件
adb push <local> <remote>
一个设备或从一个设备中拷贝文件, 复制一个文件或文件夹到设备或模拟器上:
adb push <source> <destination></destination></source>
比如:
adb push test.txt /tmp/test.txt
3 进入模拟器的shell模式
adb shell
4 查看adb命令帮助信息
adb help
5 在命令行中查看LOG信息
adb logcat -s 标签名
6 获取管理员权限
adb root
7 公布端口
你能够设置随意的端口号,做为主机向模拟器或设备的请求端口。
如: adb forward tcp:5555 tcp:8000。
8 查看bug报告
adb bugreport
9 记录无线通讯日志
一般来说。无线通讯的日志许多,在执行时不是必需去记录,但我们还是能够通过命令,设置记录:
adb shell
logcat -b radio
10 訪问数据库SQLite3
adb shell
sqlite3
Android项目创建相关命令例如以下所看到的:
举例
创建Android工程
注意:把SDK_HOME/tools和SDK_HOME/platfrom-tools加入到系统Path里,方便开发。下面两个工具在tools文件夹下。
执行命令:
android create project --target <target-id> --name MyApp \
--path <path-to-workspace>/MyApp --activity MyActivity \
--package com.allenwells.myapp
替换 ,替换 为你想要保存项目的路径。例如以下所看到的:
android create project --target android-22 --name MyApp --path D:\workplace_studio\MyApp --activity MyActivity --package com.allenwells.myapp
命令行显示工程创建流程,例如以下图所看到的:
创建后的项目工程文件夹结构例如以下图所看到的:
Android的资源打包工具是aapt。
经常使用语法格式例如以下所看到的:
aapt -A <附件资源路径> -S <资源路径> -M <Android应用清单文件> -I <额外附加的包> -F <目标文件路径>
列出资源压缩包里的内容。
查看APK里的内容
badging Print the label and icon for the app declared in APK.
permissions Print the permissions from the APK.
resources Print the resource table from the APK.
configurations Print the configurations in the APK.
xmltree Print the compiled xmls in the given assets.
xmlstrings Print the strings of the given compiled xml assets.
打包生成资源压缩包
从压缩包中删除指定文件。
向压缩包加入指定文件。
处理PNG资源并把处理结果保存到外部文件夹中。
打印aapt版本号。
具体选项參见:
Modifiers:
-a print Android-specific data (resources, manifest) when listing
-c specify which configurations to include. The default is all
configurations. The value of the parameter should be a comma
separated list of configuration values. Locales should be specified
as either a language or language-region pair. Some examples:
en
port,en
port,land,en_US
If you put the special locale, zz_ZZ on the list, it will perform
pseudolocalization on the default locale, modifying all of the
strings so you can look for strings that missed the
internationalization process. For example:
port,land,zz_ZZ
-d one or more device assets to include, separated by commas
-f force overwrite of existing files
-g specify a pixel tolerance to force images to grayscale, default 0
-j specify a jar or zip file containing classes to include
-k junk path of file(s) added
-m make package directories under location specified by -J
-u update existing packages (add new, replace older, remove deleted files)
-v verbose output
-x create extending (non-application) resource IDs
-z require localization of resource attributes marked with
localization="suggested"
-A additional directory in which to find raw asset files
-G A file to output proguard options into.
-F specify the apk file to output
-I add an existing package to base include set
-J specify where to output R.java resource constant definitions
-M specify full path to AndroidManifest.xml to include in zip
-P specify where to output public resource definitions
-S directory in which to find resources. Multiple directories will be scann
ed
and the first match found (left to right) will take precedence.
-0 specifies an additional extension for which such files will not
be stored compressed in the .apk. An empty string means to not
compress any files at all.
--debug-mode
inserts android:debuggable="true" in to the application node of the
manifest, making the application debuggable even on production devices.
--min-sdk-version
inserts android:minSdkVersion in to manifest. If the version is 7 or
higher, the default encoding for resources will be in UTF-8.
--target-sdk-version
inserts android:targetSdkVersion in to manifest.
--max-res-version
ignores versioned resource directories above the given value.
--values
when used with "dump resources" also includes resource values.
--version-code
inserts android:versionCode in to manifest.
--version-name
inserts android:versionName in to manifest.
--custom-package
generates R.java into a different package.
--extra-packages
generate R.java for libraries. Separate libraries with ‘:‘.
--generate-dependencies
generate dependency files in the same directories for R.java and resource
package
--auto-add-overlay
Automatically add resources that are only in overlays.
--preferred-configurations
Like the -c option for filtering out unneeded configurations, but
only expresses a preference. If there is no resource available with
the preferred configuration then it will not be stripped.
--rename-manifest-package
Rewrite the manifest so that its package name is the package name
given here. Relative class names (for example .Foo) will be
changed to absolute names with the old package so that the code
does not need to change.
--rename-instrumentation-target-package
Rewrite the manifest so that all of its instrumentation
components target the given package. Useful when used in
conjunction with --rename-manifest-package to fix tests against
a package that has been renamed.
--product
Specifies which variant to choose for strings that have
product variants
--utf16
changes default encoding for resources to UTF-16. Only useful when API
level is set to 7 or higher where the default encoding is UTF-8.
--non-constant-id
Make the resources ID non constant. This is required to make an R java cl
ass
that does not contain the final value but is used to make reusable compil
ed
libraries that need to access resources.
--error-on-failed-insert
Forces aapt to return an error if it fails to insert values into the mani
fest
with --debug-mode, --min-sdk-version, --target-sdk-version --version-code
and --version-name.
Insertion typically fails if the manifest already defines the attribute.
--output-text-symbols
Generates a text file containing the resource symbols of the R class in t
he
specified folder.
--ignore-assets
Assets to be ignored. Default pattern is:
!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~
举例
将当前文件夹下assets子文件夹、res子文件夹、AndroidManifest.xml文件都打包到bin\resapk资源包中
aapt -A assets -S res -M AndroidManifest.xml -I D:\my.jar -F bin/resapk
Android虚拟机并不直接执行Java的.class文件,它通过DX工具打包.class文件后执行。
DX工具用于将Android应用的.class文件转换为.dex文件。
dx命令格式例如以下所看到的:
dx --dex [--dump-to=<file>] [--core-library] [<file>.class | <file>.{zip,jar,apk} | <directory>}
举例
将D:\myproject\bin文件夹下的所有二进制文件转换为D:\文件夹下的my.dex文件。
dex -dex --dump-to=D:\my.dex --core-library D:\myproject\bin
Android应用的签名工具是jarsigner。签名之前我们须要创建一个keystore库。
keytool是密钥和证书管理工具。
keytool命令选项例如以下所看到的:
举例
创建一个名为my.keystore的keystore库
keytool -genkeypair -alias my.keystore -keyalg RSA -validity 400 -keystore my.keystore
命令执行后会提示我们填写一系列的东西,例如以下图所看到的:
填写完毕后。能够发如今当前文件夹下生成了my.keystore文件,例如以下图所看到的:
jarsigner:应用签名工具
jarsigner命令使用方法例如以下所看到的:
jarsigner [选项] jar-file 别名
jarsigner -verify [选项] jar-file [别名...]
jarsigner命令相关选项例如以下所看到的:
选项能够是 all, grouped 或 summary
举例
用my.keystore给my.apk签名
jarsigner -verbose -keystore my.keystore -signedjar my_signed.apk my.apk my.keystore
签名流程例如以下图所看到的:
【Android应用开发技术:基础构建】命令行下的Android应用开发
标签:获取 开发技术 工程文件 mpi 通讯 错误 ima workplace 下载
原文地址:http://www.cnblogs.com/blfbuaa/p/7053724.html