❶ android gradle裡面怎麼獲取manifest的meta-data值
如以下配置內容:
[html]
view
plain
<meta-data
android:name="api_key"
android:value="@string/api_key"
/>
指定的api_key值為存儲在資源文件string中的api_key值
如:
如以下配置內容:
[html]
view
plain
<meta-data
android:name="resId"
android:resource="@string/res_id"
/>
指定的resId值則是為res_id的資源id號
而不是string中的res_id值
二、如何獲取<mate-data...>元素配置的值:
1、在<application...>元素下配置<mate-data...>元素
xml代碼段:
[html]
view
plain
<application...>
.....
<meta-data
android:name="api_key"
android:value=""
/>
</application>
java代碼段:
[java]
view
plain
try
{
ApplicationInfo
appInfo
=
getPackageManager().getApplicationInfo(getPackageName(),
PackageManager.GET_META_DATA);
String
value
=
appInfo.metaData.getString("api_key");
Log.d("Tag",
"
app
key
:
"
+
value);
//
Tag﹕
app
key
:
}
catch
(PackageManager.NameNotFoundException
e)
{
e.printStackTrace();
}
2、在<activity...>元素下配置<mate-data...>元素
xml代碼段:
[html]
view
plain
<activity
...>
.....
<meta-data
android:name="resource_id"
android:resource="@string/ice"
/>
</activity>
Java代碼段:
[java]
view
plain
try
{
ActivityInfo
activityInfo
=
getPackageManager().getActivityInfo(getComponentName(),
PackageManager.GET_META_DATA);
//
獲取到的是
@string/ice
對應的資源id值
int
value
=
activityInfo.metaData.getInt("resource_id");
Log.d("Activity
Tag",
"resource_id
:
"
+
value);
//
Activity
Tag﹕
resource_id
:
2131361808
}
catch
(PackageManager.NameNotFoundException
e)
{
e.printStackTrace();
}
3、在<service...>元素下配置<mate-data...>元素
xml代碼段:
[html]
view
plain
<service
android:name="MetaDataService">
.....
<meta-data
android:name="service_meta_data"
android:value="xxxxxxx"
/>
</service>
Java代碼段:
[java]
view
plain
try
{
ComponentName
cn=new
ComponentName(this,
MetaDataService.class);
ServiceInfo
info=this.getPackageManager()
.getServiceInfo(cn,
PackageManager.GET_META_DATA);
String
value
=
info.metaData.getString("service_meta_data");
Log.d("Service
TAG",
"
value
==
"
+
value);
}
catch
(PackageManager.NameNotFoundException
e)
{
e.printStackTrace();
}
4、在<receiver...>元素下配置<mate-data...>元素
xml代碼段:
[html]
view
plain
<receiver
android:name="MetaDataReceiver">
.....
<meta-data
android:name="receiver_meta_data"
android:value="xxxxxxx"
/>
</receiver>
Java代碼段:
[java]
view
plain
try
{
ComponentName
cn=new
ComponentName(this,
MetaDataReceiver.class);
ActivityInfo
info=context.getPackageManager()
.getReceiverInfo(cn,
PackageManager.GET_META_DATA);
String
value
=
info.metaData.getString("receiver_meta_data");
Log.d("Receiver
TAG",
"
value
==
"
+
value);
}
catch
(PackageManager.NameNotFoundException
e)
{
e.printStackTrace();
}
❷ 用eclipse開發android程序,在報沖突錯誤時刪除.metadata文件之後,重新導入android項目出錯
你好,workspace目錄下的.metadata文件夾裡面只是保存了你對於eclipse這款軟體的字體、插件和配置的信息,與你具體的項目並沒有關聯。也就是說,即使你刪除了.metadata文件,你的工程文件也是不受影響的,因為他們相互獨立的。
❸ android apk怎麼通過metadata拿數據
apk是安裝程序 一般你先你要先安裝apk後綴的游戲 那些gameloft的游戲一般打開後要下載一些數據的 就是通過wifi 估計是種保護手段吧 下載的數據大的得500多M 而且下載的很慢 經常不成功 所以就有一些成功的人把他們下載的數據包拿出來分享 這樣我們安裝玩游戲後 把相應的數據吧復制過去 這樣就省了 下載數據包的過程了
❹ 為什麼讀取properties讀.metadata而不是程序本身的
最常用讀取properties文件的方法
InputStream in = getClass().getResourceAsStream("資源Name");這種方式要求properties文件和當前類在同一文件夾下面。如果在不同的包中,必須使用:
InputStream ins = this.getClass().getResourceAsStream("/cn/zhao/properties/testPropertiesPath2.properties");
Java中獲取路徑方法
獲取路徑的一個簡單實現
反射方式獲取properties文件的三種方式
1 反射方式獲取properties文件最常用方法以及思考:
Java讀取properties文件的方法比較多,網上最多的文章是"Java讀取properties文件的六種方法",但在Java應用中,最常用還是通過java.lang.Class類的getResourceAsStream(String name) 方法來實現,但我見到眾多讀取properties文件的代碼中,都會這么干:
InputStream in = getClass().getResourceAsStream("資源Name");
❺ android開發里的faq是什麼意思
android常見的FAQ
獲取手機當前的橫豎屏模式。
作用:
使用這個屬性,啟動系統的屏幕兼容程序,對app的UI在大屏幕或小屏幕上進行屏幕兼容處理。
原理:
通常對不同尺寸的屏幕我們要做不同像素的資源來進行UI布局處理,有時候這樣處理也不能達到很好的效果。此時,我們就可以用此選項來控制,在大屏幕上,是否使用系統的兼容模式來放大UI來填充屏幕,或者在小屏幕上進行縮放填充屏幕。
其他:
android metadata:
通常寫在Androidmanifest.xml文件中,以名值對的形式出現在metadata中,通常用於保存一些組件的配置信息,meta中如果全是數字的話默認為int型,其他則為字元型,最終名值對被包裝乘bundle類型,使用bundle去獲取。
❻ android sqlite3 中文亂碼問題,懇求~
樓主,插入字元的編碼和讀出時用的編碼要一致,就是說:
假設,資料庫中數據是你通過android代碼插入,以GB2312編碼格式,如:
db.execSQL("insertintoquestion_tbvalues(?,?,?,?,?,?,?)",newString(val,"gb2312"));
插入到表:
"_tb("+
"codeint,"+
"is_finishedint,"+
"is_englishint,"+
"pic_namevarchar(64),"+
"ans_backBLOB,"+
"ans_truevarchar(64),"+
"infoint"+
")";
讀出就是:
byte[]val=cursor.getBlob(cursor.getColumnIndex("ans_back"));
Stringsn;
try{
sn=newString(val,"gb2312");
}catch(UnsupportedEncodingExceptione){
e.printStackTrace();
}
就是說,插入和讀取要麼都做轉換,要麼都不做(android默認UTF-8格式)。
❼ Android使用MediaMetadataRetriever類獲取視頻幀時一直無法正確讀取路徑文件,iamge顯示位null
從API 8開始,新增了一個類:
android.media.ThumbnailUtils這個類提供了3個靜態方法一個用來獲取第一幀得到的Bitmap,2個對圖片進行縮略處理。
public static Bitmap createVideoThumbnail (String filePath, int kind)
第一個參數是文件的路徑,第二個參數是指定圖片的大小,有兩種選擇Thumbnails.MINI_KIND與Thumbnails.MICRO_KIND。
第一種文檔上說大小是512 x 384 ,我用一個MP4格式文件測試得到544 x 960,用一個wmv格式文件測試得到160 x 120。明顯不靠譜。第二種參數兩種格式文件得到的大小都是 96 x 96,這個才是縮略圖。extractThumbnail(Bitmap source, int width, int height, int options)
extractThumbnail(Bitmap source, int width, int height)
這兩種方法都是用來處理Bitmap的大小的,第一個參數是要處理的Bitmap,第二個參數是處理後寬度,第三個是高度,第四個參數options,如果options定義為OPTIONS_RECYCLE_INPUT,則回收資源。也就是說可以用第三種方法把截取到的第一幀的Bitmap轉成任意想要的大小,第三個方法還可以獲取內存卡內圖片的縮略圖。
Bitmap bitmap = ThumbnailUtils.createVideoThumbnail(path1, Thumbnails.MINI_KIND);
bitmap = ThumbnailUtils.extractThumbnail(bitmap, 210, 210);
從API 10開始新增一類MediaMetadataRetriever可以用來獲取媒體文件的信息
MediaMetadataRetriever mmr = new MediaMetadataRetriever();
mmr.setDataSource(/sdcard/33.mp4);
Bitmap bitmap = mmr.getFrameAtTime();
image.setImageBitmap(bitmap);
System.out.println(mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DATE)+);
System.out.println(mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_MIMETYPE)+);
mmr.release();
MediaMetadataRetriever可以獲取任何一幀的縮略圖。
public static Bitmap createVideoThumbnail(String filePath) {
// MediaMetadataRetriever is available on API Level 8
// but is hidden until API Level 10
Class clazz = null;
Object instance = null;
try {
clazz = Class.forName(android.media.MediaMetadataRetriever);
instance = clazz.newInstance();
Method method = clazz.getMethod(setDataSource, String.class);
method.invoke(instance, filePath);
// The method name changes between API Level 9 and 10.
if (Build.VERSION.SDK_INT <= 9) {
return (Bitmap) clazz.getMethod(captureFrame).invoke(instance);
} else {
byte[] data = (byte[]) clazz.getMethod(getEmbeddedPicture).invoke(instance);
if (data != null) {
Bitmap bitmap = BitmapFactory.decodeByteArray(data, 0, data.length);
if (bitmap != null) return bitmap;
}
return (Bitmap) clazz.getMethod(getFrameAtTime).invoke(instance);
}
} catch (IllegalArgumentException ex) {
// Assume this is a corrupt video file
} catch (RuntimeException ex) {
// Assume this is a corrupt video file.
} catch (InstantiationException e) {
Log.e(TAG, createVideoThumbnail, e);
} catch (InvocationTargetException e) {
Log.e(TAG, createVideoThumbnail, e);
} catch (ClassNotFoundException e) {
Log.e(TAG, createVideoThumbnail, e);
} catch (NoSuchMethodException e) {
Log.e(TAG, createVideoThumbnail, e);
} catch (IllegalAccessException e) {
Log.e(TAG, createVideoThumbnail, e);
} finally {
try {
if (instance != null) {
clazz.getMethod(release).invoke(instance);
}
} catch (Exception ignored) {
}
}
return null;
}
❽ android開發中怎麼獲取manifest.xml文件中的信息
1. 用Java包給應用程序命名。這個包名是應用程序的唯一標識;
2. 描述應用程序的組件---組成應用程序的Activity、Service、Broadcast Receiver以及Content Provider。它要用每個組件的實現類來命名,並向外發布對應組件功能(例如,組件所能處理的Intent消息)。這些聲明會讓Android系統了解應用程序中組件,以及這些組件被載入的條件。
3. 判斷哪些進程是主應用程序組件。
4. 聲明應用程序所必須的許可權,以便能夠訪問被保護的API,以及能夠跟其他應用程序進行交互。
5. 為了跟應用程序組件進行交互,還聲明了其他要求有的許可權。
6. 列出了能夠提供應用程序運行時的分析和其他信息的Instrumentation類。只有在開發和測試應用程序時才在清單文件中聲明這些類,在應用程序被發布之前,要刪除這些類。
7. 聲明應用程序所要求的最小的Android API級別。
8. 列出應用程序必須鏈接的外部庫。
❾ android 基本文件操作命令
ADB (Android Debug Bridge)
說明:下面一些命令需要有root許可權才能執行成功
快速啟動dos窗口執行adb:
1. adb.exe所在路徑添加到系統環境變數中
2. 配置快捷鍵啟動dos
進入C:\WINDOWS\system32目錄下,找到cmd.exe.
右擊菜單 "發送到" -> 桌面快捷方式。
在桌面上右擊"快捷方式 到 cmd.exe" -> "屬性" -> "快捷方式"頁
-> 游標高亮"快捷鍵" -> 按下自定義快捷鍵 (如:Ctrl + Alt + Z)
任何情況下,按下Ctrl + Alt + Z啟動dos窗口就可以執行adb命令了
-----------查看設備連接狀態 系列-----------
adb get-serialno 獲取設備的ID和序列號serialNumber
adb devices 查詢當前計算機上連接那些設備(包括模擬器和手機),輸出格式: [serialNumber] [state]
adb get-state 查看模擬器/設施的當前狀態.
說明:
序列號[serialNumber]——由adb創建的一個字元串,這個字元串通過自己的控制埠<type>-<consolePort>
唯一地識別一個模擬器/設備實例。一個序列號的例子: emulator-5554
-----------發送命令到設備 系列-----------
adb [-d|-e|-s <serialNumber>] <command>
-d 發送命令給usb連接的設備
-e 發送命令到模擬器設備
-s <serialNumber> 發送命令到指定設備
如啟動手機設備shell: adb -d shell
adb forward <local> <remote>發布埠,可以設置任意的埠號,
做為主機向模擬器或設備的請求埠。如:adb forward tcp:5555 tcp:8000
adb reboot 重啟手機
adb remount 將system分區重新掛載為可讀寫分區
adb kill-server 終止adb服務進程
adb start-server 重啟adb服務進程
adb root 已root許可權重啟adb服務
adb wait-for-device 在模擬器/設備連接之前把命令轉載在adb的命令器中
adb jdwp 查看指定的設施的可用的JDWP信息.
可以用 forward jdwp:<pid> 埠映射信息來連接指定的JDWP進程.例如:
adb forward tcp:8000 jdwp:472
jdb -attach localhost:8000
adb shell am 命令可以啟動應用程序
adb shell input text <string> 向設備輸入文本(游標所在的文本框)
adb shell input keyevent <event_code> 向設備發送按鍵事件
如:
在編輯簡訊時,往文本框輸入文本:adb shell input text "hello"
向手機發送鍵值回Home:adb shell input keyevent 3
event_code 參考view/KeyEvent.java中的 KEYCODE_*
public static final int KEYCODE_SOFT_LEFT = 1;
public static final int KEYCODE_SOFT_RIGHT = 2;
public static final int KEYCODE_HOME = 3;
public static final int KEYCODE_BACK = 4;
public static final int KEYCODE_CALL = 5;
public static final int KEYCODE_ENDCALL = 6;
-----------安裝卸載 系列-----------
adb install [-l] [-r] <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)
adb uninstall [-k] <package> - remove this app package from the device
('-k' means keep the data and cache directories)
如:
adb install d:\hello.apk
adb unstall com.huawei.hello
說明:如果帶-r選項重新安裝apk時,安裝在 /data/local/tmp/目錄下,手機重啟後還是使用原來的apk.
-----------文件操作 系列-----------
adb push <local> <remote> - file/dir to device
adb pull <remote> <local> - file/dir from device
-----------基本linux shell命令 系列-----------
adb shell [command]
ls 列出目錄下的文件和文件夾
cd 切換目錄
rm 刪除目錄和文件
cat 查看文件內容
ps 可以看那個進程再跑
ps -x [PID] 查看單個進程的狀態
top 可以看那個進程的佔用率最高
su 切換到root用戶
kill [pid] 殺死一個進程
chmod 777 <file> 修改該文件為可執行許可權
詳細使用情況可以登錄一台Linux伺服器在shell下查看幫助手冊, man <command>
-----------查看系統狀態和信息 系列-----------
adb shell procrank 查詢各進程內存使用情況
adb shell service list 查看services信息
adb shell cat /proc/meminfo 查看當前的內存情況
adb shell cat /proc/cpuinfo 查看CPU信息(硬體)
adb shell cat /proc/iomem 查看IO內存分區
adb shell getprop 列出系統所有屬性
adb shell getprop | findstr "gsm" 列出包含gsm的屬性
adb shell setprop <key> <value> 修改系統屬性
adb shell sqlite3 可以執行sql語句查看資料庫信息, 具體使用情況待調查
-----------Log 系列-----------
adb logcat [ <filter-spec> ] - View device log
1~~~~~~~~~~~查看可用日誌緩沖區:
adb logcat -b radio — 查看緩沖區的相關的信息.
adb logcat -b events — 查看和事件相關的的緩沖區.
adb logcat -b main — 查看主要的日誌緩沖區
2~~~~~~~~~~~過濾日誌輸出:
過濾器語句按照下面的格式描tag:priority ... , tag 表示是標簽, priority 是表示標簽的報告的最低等級
adb logcat *:W 顯示優先順序為warning或更高的日誌信息
adb logcat ActivityManager:I MyApp:D *:S
日誌的標簽是系統部件原始信息的一個簡要的標志。(比如:「View」就是查看系統的標簽).
優先順序有下列集中,是按照從低到高順利排列的:
V — Verbose (lowest priority)
D — Debug
I — Info
W — Warning
E — Error
F — Fatal
S — Silent (highest priority, on which nothing is ever printed)
如果你電腦上運行logcat ,相比在遠程adbshell端,你還可以為環境變數ANDROID_LOG_TAGS :輸入一個參數來設置默認的過濾
export ANDROID_LOG_TAGS="ActivityManager:I MyApp:D *:S"
需要注意的是ANDROID_LOG_TAGS 過濾器如果通過遠程shell運行logcat 或用adb shell logcat 來運行模擬器/設備不能輸出日誌.
3~~~~~~~~~~~控制日誌輸出格式:
日誌信息包括了許多元數據域包括標簽和優先順序。可以修改日誌的輸出格式,所以可以顯示出特定的元數據域。可以通過 -v 選項得到格式化輸出日誌的相關信息.
brief — Display priority/tag and PID of originating process (the default format).
process — Display PID only.
tag — Display the priority/tag only.
thread — Display process:thread and priority/tag only.
raw — Display the raw log message, with no other metadata fields.
time — Display the date, invocation time, priority/tag, and PID of the originating process.
long — Display all metadata fields and separate messages with a blank lines.
當啟動了logcat ,你可以通過-v 選項來指定輸出格式:
[adb] logcat [-v <format>]
下面是用 thread 來產生的日誌格式:
adb logcat -v thread
需要注意的是你只能-v 選項來規定輸出格式 option.
4~~~~~~~~~~~Logcat命令列表
-b <buffer> 載入一個可使用的日誌緩沖區供查看,比如event 和radio . 默認值是main 。具體查看Viewing Alternative Log Buffers.
-c 清楚屏幕上的日誌.
-d 輸出日誌到屏幕上.
-f <filename> 指定輸出日誌信息的<filename> ,默認是stdout .
-g 輸出指定的日誌緩沖區,輸出後退出.
-n <count> 設置日誌的最大數目<count> .,默認值是4,需要和 -r 選項一起使用。
-r <kbytes> 每<kbytes> 時輸出日誌,默認值為16,需要和-f 選項一起使用.
-s 設置默認的過濾級別為silent.
-v <format> 設置日誌輸入格式,默認的是brief 格式,要知道更多的支持的格式,參看Controlling Log Output Format
adb bugreport - return all information from the device
that should be included in a bug report.
adb shell dmesg 查詢內核緩沖區信息
adb shell mpstate 各類信息,比如進程信息,內存信息,進程是否異常,kernnel的log等
adb shell mpcrash
adb shell mpsys 查詢所有service的狀態
-----------其他 -----------
模擬器使用鏡像sdcard
用SDK里的mksdcard工具來創建FAT32磁碟鏡像並在模擬器啟動時載入它。這樣創建鏡像:? mksdcard <size> <file>,
比如我要創建一個64M的SD卡模擬文件,文件路徑是在D:\workspace\sdcard.img
mksdcard 64000000 D:\workspace\sdcard.img
Emulator –sdcard D:\workspace\sdcard.img
或者在eclipse的run菜單的open run dialog對話框中配置啟動參數。
#top
Usage: top [ -m max_procs ] [ -n iterations ] [ -d delay ] [ -s sort_column ] [ -t ] [ -h ]
-m num Maximum number of processes to display.
-n num Updates to show before exiting.
-d num Seconds to wait between updates.
-s col Column to sort by (cpu,vss,rss,thr).
-t Show threads instead of processes.
-h Display this help screen.
********* simple selection ********* ********* selection by list *********
-A all processes -C by command name
-N negate selection -G by real group ID (supports names)
-a all w/ tty except session leaders -U by real user ID (supports names)
-d all except session leaders -g by session OR by effective group name
-e all processes -p by process ID
T all processes on this terminal -s processes in the sessions given
a all w/ tty, including other users -t by tty
g OBSOLETE -- DO NOT USE -u by effective user ID (supports names)
r only running processes U processes for specified users
x processes w/o controlling ttys t by tty
*********** output format ********** *********** long options ***********
-o,o user-defined -f full --Group --User --pid --cols --ppid
-j,j job control s signal --group --user --sid --rows --info
-O,O preloaded -o v virtual memory --cumulative --format --deselect
-l,l long u user-oriented --sort --tty --forest --version
-F extra full X registers --heading --no-heading --context
********* misc options *********
-V,V show version L list format codes f ASCII art forest
-m,m,-L,-T,H threads S children in sum -y change -l format
-M,Z security data c true command name -c scheling class
-w,w wide output n numeric WCHAN,UID -H process hierarchy
netstat -ano 查看網路連狀態
顯示協議統計信息和當前 TCP/IP 網路連接。
NETSTAT [-a] [-b] [-e] [-n] [-o] [-p proto] [-r] [-s] [-v] [interval]
-a 顯示所有連接和監聽埠。
-b 顯示包含於創建每個連接或監聽埠的
可執行組件。在某些情況下已知可執行組件
擁有多個獨立組件,並且在這些情況下
包含於創建連接或監聽埠的組件序列
被顯示。這種情況下,可執行組件名
在底部的 [] 中,頂部是其調用的組件,
等等,直到 TCP/IP 部分。注意此選項
可能需要很長時間,如果沒有足夠許可權
可能失敗。
-e 顯示乙太網統計信息。此選項可以與 -s
選項組合使用。
-n 以數字形式顯示地址和埠號。
-o 顯示與每個連接相關的所屬進程 ID。
-p proto 顯示 proto 指定的協議的連接;proto 可以是
下列協議之一: TCP、UDP、TCPv6 或 UDPv6。
如果與 -s 選項一起使用以顯示按協議統計信息,proto 可以是下列協議之一:
IP、IPv6、ICMP、ICMPv6、TCP、TCPv6、UDP 或 UDPv6。
-r 顯示路由表。
-s 顯示按協議統計信息。默認地,顯示 IP、
IPv6、ICMP、ICMPv6、TCP、TCPv6、UDP 和 UDPv6 的統計信息;
-p 選項用於指定默認情況的子集。
-v 與 -b 選項一起使用時將顯示包含於
為所有可執行組件創建連接或監聽埠的
組件。
interval 重新顯示選定統計信息,每次顯示之間
暫停時間間隔(以秒計)。按 CTRL+C 停止重新
顯示統計信息。如果省略,netstat 顯示當前
配置信息(只顯示一次)
pm
usage: pm [list|path|install|uninstall]
pm list packages [-f]
pm list permission-groups
pm list permissions [-g] [-f] [-d] [-u] [GROUP]
pm list instrumentation [-f] [TARGET-PACKAGE]
pm list features
pm path PACKAGE
pm install [-l] [-r] [-t] [-i INSTALLER_PACKAGE_NAME] PATH
pm uninstall [-k] PACKAGE
pm enable PACKAGE_OR_COMPONENT
pm disable PACKAGE_OR_COMPONENT
The list packages command prints all packages. Options:
-f: see their associated file.
The list permission-groups command prints all known
permission groups.
The list permissions command prints all known
permissions, optionally only those in GROUP. Options:
-g: organize by group.
-f: print all information.
-s: short summary.
-d: only list dangerous permissions.
-u: list only the permissions users will see.
The list instrumentation command prints all instrumentations,
or only those that target a specified package. Options:
-f: see their associated file.
The list features command prints all features of the system.
The path command prints the path to the .apk of a package.
The install command installs a package to the system. Options:
-l: install the package with FORWARD_LOCK.
-r: reinstall an exisiting app, keeping its data.
-t: allow test .apks to be installed.
-i: specify the installer package name.
The uninstall command removes a package from the system. Options:
-k: keep the data and cache directories around.
after the package removal.
The enable and disable commands change the enabled state of
a given package or component (written as "package/class").
查看stdout 和stderr
在默認狀態下,Android系統有stdout 和 stderr (System.out和System.err )輸出到/dev/null ,
在運行Dalvik VM的進程中,有一個系統可以備份日誌文件。在這種情況下,系統會用stdout 和stderr 和優先順序 I.來記錄日誌信息
通過這種方法指定輸出的路徑,停止運行的模擬器/設備,然後通過用setprop 命令遠程輸入日誌
$ adb shell stop
$ adb shell setprop log.redirect-stdio true
$ adb shell start系統直到你關閉模擬器/設備前設置會一直保留,可以通過添加/data/local.prop 可以使用模擬器/設備上的默認設置
UI/軟體 試驗程序 Monkey
當Monkey程序在模擬器或設備運行的時候,如果用戶出發了比如點擊,觸摸,手勢或一些系統級別的事件的時候,
它就會產生隨機脈沖,所以可以用Monkey用隨機重復的方法去負荷測試你開發的軟體.
最簡單的方法就是用用下面的命令來使用Monkey,這個命令將會啟動你的軟體並且觸發500個事件.
$ adb shell monkey -v -p your.package.name 500
更多的關於命令Monkey的命令的信息,可以查看UI/Application Exerciser Monkey documentation page.