Android汇总

1.问题:make: *** [out/target/common/obj/PACKAGING/checkapi-current-timestamp] erroe 38
解决措施:make update-api

说明:如果你在Android源码中添加了自定义的包、类、方法或者你修改了Android源码中标识为@hide的方法、类,你需要这些内容对Application可见并且需要编译进SDK的Document中的话,这个命令是必须的(也可以通过手工修改的方法解决,先下载新代码源码编译。错误后执行 make update-api 。以后不会有错误。然后找到frameworks/base/api/current.txt,把这个文件替换代码库的frameworks/base/api/current.txt。以后你从代码库下载最新代码就不需要make update-api)


2.android如何增加第三方so和jar
http://wenku.baidu.com/link?url=MJM1JZPgCHn_TugrNHJ0EdUNJeKLN7h5V468u08EadqtH-2cnKJqSXB0svEq8JEnFiBmm0x9MdamwW9PQSrz1Ru66jc_Rt9-e4Max3Lcoyi


3.window dump
adb shell dumpsys window > window.txt

power dump
adb shell dumpsys power > power.txt

查询ActivityStack
adb shell dumpsys activity activities

adb shell printenv
adb shell service list


4.改变屏幕的density
adb shell wm density 160
adb shell wm size 768x1366
current width x  160 / current density  = 资源分类如sw600dp


5.获取屏幕的density
getprop ro.sf.lcd_density

6.获取backlight值
adb shell cat /sys/class/leds/lcd-backlight/brightness

change lcd backlight
echo 102 > /sys/class/leds/lcd-backlight/brightness


7.查询Memory
adb shell dumpsys meminfo
adb shell cat /proc/meminfo 


8.Smali debug
Add a log in smali code:
const-string v0, "DebugInfo"
const-string v1, "return-void"
invoke-static {v0, v1}, Landroid/util/Log;->v(Ljava/lang/String;Ljava/lang/String;)I
Print call stack in smali:
new-instance v0, Ljava/lang/Exception;
invoke-direct {v0}, Ljava/lang/Exception;->()V
invoke-virtual {v0}, Ljava/lang/Exception;->printStackTrace()V

9.adb log
# logcat -b main //show main buffer
# logcat -b radio //show radio buffer
# logcat -b events //show event buffer

10.Uart Console打开和关闭
adb shell "echo 1 > /sys/module/printk/parameters/disable_uart"
adb shell "echo 0 > /sys/module/printk/parameters/disable_uart"


11.截图
adb shell screencap -p /sdcard/screen.png


12.ENG版本关闭SELinux
adb shell getenforce //获取
getenforce
Enforcing
adb shell setenforce 0 //关闭


13.Settings命令
#获取
adb shell settings get global airplane_mode_radios
cell,bluetooth,wifi,nfc,wimax
adb shell settings get secure default_input_method
com.android.inputmethod.latin/.LatinIME
#更改
adb shell settings put secure default_input_method com.sohu.inputmethod.sogouoem/.SogouIME


14.解决INSTALL_FAILED_SHARED_USER_INCOMPATIBLE问题
#apk签名
java -jar signapk.jar platform.x509.pem platform.pk8 test.apk test_signed.apk


15.checkjni
#打开
android:debuggable="true"
adb shell setprop debug.checkjni 1
#关闭
adb shell setprop dalvik.vm.checkjni false
adb shell stop
adb shell start


16.#define LOG_NDEBUG 0
#undef NDEBUG
#include  
adb logcat TAG1:PRIORITY TAG2:PRIORITY
->adb logcat libsuspend:V *:S  //后面的*:S就是把其他模块的LOG全部屏蔽掉,这样只打印libsuspend的log信息


17.Check CPU loading
adb shell top -m 10 -d 2


18.input power key
adb shell input keyevent 26


1ns(nanosecond纳秒)=1000ps(picosecond皮秒)
1us(microsecond微秒)=1000ns(nanosecond纳秒)
1ms(millisecond毫秒)=1000us(microsecond微秒)
1s(second秒)=1000ms(millisecond毫秒)


android2.2   API8
android2.3.3 API10
android4.0.3 API15
android4.1.2 API16
android4.2.2 API17
android4.3.1 API18
android4.4.2 API19
android4.4w.2API20
android5.0.1 API21
android5.1.1 API22
android6.0    API23


http://developer.android.com/tools/debugging/debugging-tracing.html
http://developer.android.com/tools/help/systrace.html#options
https://code.google.com/p/smali/downloads/list
http://ibotpeaches.github.io/Apktool/
https://software.intel.com/en-us/android/articles/third-party-application-debug-reference-on-intel-processor-based-platforms-part-2
http://developer.android.com/tools/device.html
http://source.android.com/source/building.html
https://lwn.net/images/pdf/LDD3/
http://www.php.net/session_start
http://www.w3school.com.cn/php/php_ref_string.asp
http://blog.163.com/lgh_2002/blog/static/4401752620105246517509/
http://www.cocoachina.com/special/swift/
http://show-ip.net/browserinfo/
https://www3.ntu.edu.sg/home/ehchua/programming/java/JavaNativeInterface.html
http://blog.csdn.net/windskier/article/details/6913698
http://blog.csdn.net/windskier/article/details/6921672
http://codingnow.cn/android/1078.html
http://blog.sina.com.cn/s/blog_71fa0df50100v2gv.html
http://blog.csdn.net/cybertan/article/details/8258394
http://blog.csdn.net/pi9nc/article/details/27503071
http://www.mamicode.com/info-detail-1015135.html
http://blog.csdn.net/hguisu/article/details/7445768/
http://blog.csdn.net/haomcu/article/details/7371835
http://blog.csdn.net/zi_jin/article/details/4214359
http://blog.csdn.net/jibcy/article/details/7195731
http://blog.csdn.net/fancsxx/article/details/8811565
http://www.cnblogs.com/softwaretesting/archive/2011/07/12/2104435.html
http://blog.csdn.net/yangzhijun_cau/article/details/6432216
http://blog.csdn.net/longxibendi/article/details/38276847
http://blog.csdn.net/wooin/article/details/1858917
http://www.2cto.com/kf/201412/361281.html
http://blog.csdn.net/droidphone/article/details/8074892
http://www.ti.com/product/BQ24296M/datasheet/pin_configuration_and_functions#SLUSBC12619
http://blog.csdn.net/wn360459196/article/details/11031073

你可能感兴趣的:(Android)