android Tips

本文记录下android学习中的一些知识点

  logcat:

// java层的logcat我们不谈,看native层:/system/core/include/log/log.h以ALOGV()为例,
/*
50 * Normally we strip ALOGV (VERBOSE messages) from release builds.
51 * You can modify this (for example with "#define LOG_NDEBUG 0"
52 * at the top of your source file) to change that behavior.
53 */
#ifndef LOG_NDEBUG
#ifdef NDEBUG
#define LOG_NDEBUG 1
#else
#define LOG_NDEBUG 0
#endif
#endif

#ifndef ALOGV
#if LOG_NDEBUG
#define ALOGV(...)   ((void)0)
#else
#define ALOGV(...) ((void)ALOG(LOG_VERBOSE, LOG_TAG, __VA_ARGS__))
#endif
#endif
// 需设置#define LOG_NDEBUG 0才能输出系统的ALOGV()信息
#define ALOG(priority, tag, ...) \
    LOG_PRI(ANDROID_##priority, tag, __VA_ARGS__)
#endif
/*
 * Log macro that allows you to specify a number for the priority.
 */
#ifndef LOG_PRI
#define LOG_PRI(priority, tag, ...) \
    android_printLog(priority, tag, __VA_ARGS__)
#endif
// 你可以看看从ALOGV一直到__android_log_print,
// 而__android_log_print就关联的日志的写文件操作,这里我们先不提
#define android_printLog(prio, tag, fmt...) \
    __android_log_print(prio, tag, fmt)

// 接下来我们看看系统中的logcat文件
$ adb shell dmesg > dmesg.txt   linux内核启动log,init进程log
$ adb logcat -d -v time -b "main"   >  main.txt  Zygote进程log
$ adb logcat -d -v time -b "system" >  system.txt SystemServer进程的log
$ adb logcat -d -v time -b "events" >   events .txt
// 详情看 Android内核开发:学会分析系统启动log http://ticktick.blog.51cto.com/823160/1662911

时间: 2024-08-06 16:01:37

android Tips的相关文章

[Android Tips] 9. framework notification layout font size

android 4.4 framework notification layout 相关字体大小 * title: notification_title_text_size: 18dp * content: notification_text_size: 14dp * subtext: notification_subtext_size: 12dp [Android Tips] 9. framework notification layout font size

[Android Tips] 8. Install apk on multiple connected devices

$ adb devices | tail -n +2 | cut -sf 1 | xargs -I X adb -s X install pathto/myapp-release.apk [Android Tips] 8. Install apk on multiple connected devices

Android Tips – 填坑手册

出于: androidChina   http://www.androidchina.net/3595.html 学习 Android 至今,大大小小的坑没少踩,庆幸的是,在强大的搜索引擎与无私奉献的人们的帮助下,我遇到的坑都顺利地被填平了. 为了便于日后遇到同样的问题时,能免于再次搜索带来的麻烦,我养成了收藏书签的习惯,随着书签(Tips)的日积月累,我想,是时候该有这个项目了. 如果你是个 Android 新人,那么我希望这份列表,可以成为你踩到坑时的不完全手册. 当然,这份列表一定会有遗漏

[Android Tips] INSTALL_PARSE_FAILED_MANIFEST_MALFORMED on Android-2.1

最近在 http://testin.cn 上的多款 android 2.1 设备上出现安装失败的问题 INSTALL_PARSE_FAILED_MANIFEST_MALFORMED 问题分析 貌似 android 2.1 AndroidManifest.xml provider 元素的 authorities 属性不支持如 @string/xxx_authorities 的字符串引用. 解决方案 使用字符串字面值,而不是其引用 [Android Tips] INSTALL_PARSE_FAILE

android tips—NumberPicker,DataPicker,TimePicker样式修改

在使用NumberPicker,DataPicker,TimePicker这几个控件时,很容易出现如下这个界面 但是我们想要的却是下面图示的结果 修改Application,activity的android:theme这个值.最直观的效果去掉android:theme即可. 本tips 在 android4.4上测试通过.

android tips—NumberPicker,DataPicker,TimePicker样式改动

在使用NumberPicker.DataPicker,TimePicker这几个控件时,非常easy出现例如以下这个界面 可是我们想要的却是以下图示的结果 改动Application.activity的android:theme这个值. 最直观的效果去掉android:theme就可以. 本tips 在 android4.4上測试通过.

android tips—启动Emergency call拨号盘

Intent intent = new Intent(); intent.setAction("com.android.phone.EmergencyDialer.DIAL"); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity();

android tips—开机引导启动wifi设置

在开机引导(Setupwizard,Guide)中都有关于wifi设置项,我得做法如下: Intent intent = new Intent(); intent.setClassName("com.android.settings", "com.android.settings.wifi.WifiSetupActivity"); intent.putExtra("firstRun",false); startActivity(intent);

Android tips(十)-->允许模拟位置在Android M下的坑

转载请标明出处:一片枫叶的专栏 本文我们将讲解允许模拟位置在Android M下的坑.做地图类应用的同学应该都知道为了避免软件模拟位置影响正常流程的进行我们一般都会判断用户手机是否打开了模拟位置设置,若打开了则终止用户流程,提醒用户关闭模拟位置设置.在android系统的开发者选项中有一个模拟位置的选项,其作用是允许用户通过代码模拟设备的当前位置,比如地图类应用需要测试在外地的使用情况,通过开启此项选项可以通过代码模拟位置,具体可参考我的:Android中的开发者选项 允许模拟位置的设置选项在手