Android.bat的运行选项
"list ":
"list avd":
"list target":
"create avd":
"move avd":
"delete avd":
"update avd":
"create project":
"update project":
"update adb":
adb.exe的运行选项
Android Debug Bridge
Android的调试桥,运行该命令时必须先启动模拟器;然后才可以在模拟器上运行linux命令或安装卸载apk软件。
adb devices - list all connected devices
device commands:
adb push <local> <remote> - copy file/dir to device
adb pull <remote> <local> - copy file/dir from device
adb sync [ <directory> ] - copy host->device only if changed
(see 'adb help all')
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 forward <local> <remote> - forward socket connections
forward specs are one of:
tcp:<port>
localabstract:<unix domain socket name>
localreserved:<unix domain socket name>
localfilesystem:<unix domain socket name>
dev:<character device name>
jdwp:<process pid> (remote only)
adb jdwp - list PIDs of processes hosting a JDWP transport
adb install [-l] [-r] <file> - push this package file to the device and install it
adb uninstall [-k] <package> - remove this app package from the device
-- 这个package名称是在AndroidManifest.xml文件中定义的
scripting:
adb wait-for-device - block until device is online
adb start-server - ensure that there is a server running
adb kill-server - kill the server if it is running
adb get-state - prints: offline | bootloader | device
adb get-serialno - prints: <serial-number>
adb status-window - continuously print device status for a specified device
adb remount - remounts the /system partition on the device read-write
adb root - restarts adb with root permissions
apk文件在模拟器上的安装和卸载
安装
D:\android\tools>adb install c:\NetScramble_1.1.apk
卸载
D:\android\tools>adb uninstall bison.sample.helloworld
或者
D:\android\tools>adb shell rm data/app/NetScramble_1.1.apk
使用这种办法,可以提高开发调试的速度。
AndroidManifest.xml文件详解
Android全局配置文件AndroidManifest.xml
在最外层包含了包名如 package="cn.android123.demo" 、软件的版本号 android:versionCode="1" 以及 android:versionName="1.0" ,里面一层的application分支中将可能包含Android程序的四种对象 Activity、Service、Content Provider以及Receiver。我们每添加上面四个类型中的任一新对象都需要在androidmanifest.xml文件中添加相应节点。
其中Activity的属性常用的可能为android:name和android:label但我们需要了解所有的属性以帮助解决复杂的问题,完整的如下:
android:allowTaskReparenting=["true" | "false"]
android:alwaysRetainTaskState=["true" | "false"]
android:clearTaskOnLaunch=["true"" | "false"]
android:configChanges=[one or more of: "mcc" "mnc" "locale"
"touchscreen" "keyboard" "keyboardHidden"
"navigation" "orientation" "fontScale"]
android:enabled=["true" | "false"]
android:excludeFromRecents=["true" | "false"]
android:exported=["true" | "false"]
android:finishOnTaskLaunch=["true" | "false"]
android:icon="drawable resource"
android:label="string resource"
android:launchMode=["multiple" | "singleTop" |
"singleTask" | "singleInstance"]
android:multiprocess=["true" | "false"]
android:name="string"
android:noHistory=["true" | "false"]
android:permission="string"
android:process="string"
android:screenOrientation=["unspecified" | "user" | "behind" |
"landscape" | "portrait" |
"sensor" | "nonsensor"]
android:stateNotNeeded=["true" | "false"]
android:taskAffinity="string"
android:theme="resource or theme"
android:windowSoftInputMode=[one or more of: "stateUnspecified"
"stateUnchanged" "stateHidden"
"stateAlwaysHidden" "stateVisible"
"stateAlwaysVisible" "adjustUnspecified"
"adjustResize" "adjustPan"] >
基础知识
·手机屏幕参数的了解
市面上常规的机型使用了320x240的 QVGA。N73就是这种分辨率。
比如目前使用的是480x320的 HVGA
800x480的 WVGA