zoukankan      html  css  js  c++  java
  • Android 开发环境搭建以及工具(不断更新)

    学习android需要学习的编程知识

    https://wiki.cyanogenmod.org/w/Doc:_Development_Resources

    从http://source.android.com/source下载的网页

    http://pan.baidu.com/s/1sjoMt5r

    Android开发软件Android Studio

    http://www.android-studio.org/index.php

     

    详细显示编译过程

    make -j4 showcommands

     一些常用的编译目标

    Here is a list of different make targets you can use to build different parts of the system:
    
        make sdk - build the tools that are part of an SDK (adb, fastboot, etc.)
        make snod - build the system image from the current software binaries
        make services
        make runtime
        make droid - make droid is the normal build.
        make all - make everything, whether it is included in the product definition or not
        make clean - remove all built files (prepare for a new build). Same as rm -rf out/<configuration>/
        make modules - shows a list of submodules that can be built (List of all LOCAL_MODULE definitions)
        make <local_module> - make a specific module (note that this is not the same as directory name. It is the LOCAL_MODULE definition in the Android.mk file)
        make clean-<local_module> - clean a specific module
        make bootimage TARGET_PREBUILT_KERNEL=/path/to/bzImage - create a new boot image with custom bzImage

    一些常用的宏和函数

    There are some helper macros and functions that are installed when you source envsetup.sh. They are documented at the top of envesetup.sh, but here is information about a few of them:
    
        croot - change directory to the top of the tree
        m - execute 'make' from the top of the tree (even if your current directory is somewhere else)
        mm - builds all of the modules in the current directory
        mmm <dir1> ... - build all of the modules in the supplied directories
        cgrep <pattern> - grep on all local C/C++ files
        jgrep <pattern> - grep on all local Java files
        resgrep <pattern> - grep on all local res/*.xml files
        godir <filename> - go to the directory containing a file

     介绍Android源码下每个目录的作用

     https://wiki.cyanogenmod.org/w/Doc:_the_cm_source

    重新编译某个模块

    To rebuild only the module which you are changing (ie, the stuff in your current directory), you can usually do this:
    
    mm -B 
    

    将Android源码导入Android Studio

    https://wiki.cyanogenmod.org/w/Doc:_import_to_intellij

     

    Android调试工具

    1. systrace 

    (用systrace调试display system:http://files.cnblogs.com/files/pengdonglin137/Systrace_for_Display_System-140420101020-phpapp02%281%29.pdf)

    用法:systrace这个工具在Android源码目录下的external/chromium-trace/下,用法(使用-h参数可以获得更详细的帮助信息):

    •  ./systrace.py -e emulator-5554 -l        

                     gfx - Graphics
           input - Input
            view - View System
         webview - WebView
              wm - Window Manager
              am - Activity Manager
              sm - Sync Manager
           audio - Audio
           video - Video
          camera - Camera
             hal - Hardware Modules
             app - Application
             res - Resource Loading
          dalvik - Dalvik VM
              rs - RenderScript
          bionic - Bionic C Library
           power - Power Management
           sched - CPU Scheduling
             irq - IRQ Events
            freq - CPU Frequency
            idle - CPU Idle
            disk - Disk I/O
             mmc - eMMC commands
           workq - Kernel Workqueues
      memreclaim - Kernel Memory Reclaim


    • ./systrace.py -e emulator-5554 gfx sched video -t 60 -o "`date +%y-%m-%d-%H-%M-%S`".html
    • 那么如何在要调试的代码中加入相应的systrace可以识别的信息呢?

    以media/libmedia/AudioTrack.cpp为例:

    #define ATRACE_TAG  ATRACE_TAG_ALWAYS  

    // 表示一直会打开,如果是ATRACE_TAG_AUDIO,则需要在systrace中加入audio参数才能看到

    #include <utils/Trace.h>

    然后在需要调试的函数的入口(以AudioTrack::start)为例:

     status_t AudioTrack::start()
     {
    +    ATRACE_NAME("AudioTrack::start");
         status_t status = NO_ERROR;
         AutoMutex lock(mLock);
         if (mState == STATE_ACTIVE) {
    或者

     status_t AudioTrack::start()
     {
    +    ATRACE_CALL();
         status_t status = NO_ERROR;
         AutoMutex lock(mLock);
         if (mState == STATE_ACTIVE) {

     

    2. dumpsys

    3. pytimechart 

    4. ftrace 和 trace_cmd

    媒体文件重新识别

    下面的命令可以让sdcard上的媒体文件重新识别,当使用adb push命令向手机里放入媒体文件后,手机并不能立即识别这个媒体文件,需要重启手机,下面的命令可以不用重启手机。

    #! /bin/bash
    
    adb shell am broadcast -a android.intent.action.MEDIA_MOUNTED -d file:///mnt/sdcard/

    Android示例代码学习

    在android源代码的cts目录下有很多示例代码,其中的程序都不是很复杂,值得学习一下。

    media相关的: cts/tests/tests/media/src/android/media/cts

    graphic相关的: cts/tests/tests/graphics/src/android/graphics/cts

    ADB 工具

    下载地址:https://developer.android.com/studio/releases/platform-tools.html

    或者点击这里下载: windows版   Linux版

       

     

     

  • 相关阅读:
    强化学习
    训练深度神经网络失败的罪魁祸首是退化
    wod2vec&fasttext&doc2vec#ida2vec
    leetcode动态规划之最长回文子串
    数据增强
    【认证与授权】Spring Security自定义页面
    【认证与授权】Spring Security的授权流程
    【认证与授权】Spring Security系列之认证流程解析
    【认证与授权】Spring Security系列之初体验
    【认证与授权】2、基于session的认证方式
  • 原文地址:https://www.cnblogs.com/pengdonglin137/p/4507197.html
Copyright © 2011-2022 走看看