Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用adb调试应用 #21

Open
riskers opened this issue Mar 8, 2016 · 1 comment
Open

使用adb调试应用 #21

riskers opened this issue Mar 8, 2016 · 1 comment
Labels
Native 大前端

Comments

@riskers
Copy link
Owner

riskers commented Mar 8, 2016

安卓开发中,adb是很重要的调试手段。其实,对于前端来说,adb工具也是学习一下的,因为它确实很方便。

比如,我在手机助手中,调试一个安装APP的页面,这个过程中就要反复下载应用安装,然后退出页面卸载,很麻烦,使用adb就只要一条命令就可以卸载应用了。再比如,APP中一般会缓存数据,这样给我们调试也带来很多麻烦,如果不使用adb清除缓存的话,就必须去设置里清除,太麻烦了。

所以来学学adb吧

安装

  1. 安装 JDK

  2. 下载 SDK

  3. 解压 SDK 压缩包,然后进入 android-sdk-macoxs/tools,双击 android 启动 Android SDK Manager,安装 build tools

  4. 在自己的目录(home directory)中创建 .bash_profile

    cd ~
    touch .bash_profile
  5. .bash_profile 中写下:

    export PATH=${PATH}:/Users/xxx/android-sdk-macosx/tools
    export PATH=${PATH}:/Users/xxx/android-sdk-macosx/platform-tools

    路径是不固定的,指向 android-sdk-macosx 目录即可

  6. 执行

    source .bash_profile
  7. 输入 adb 回车,就可以看到adb界面了

命令

只说我最常用的两条命令

卸载应用

adb shell pm uninstall com.example.MyApp

com.example.MyApp 是应用的包名


清除缓存

adb shell pm clear com.example.MyApp

更多的命令请看这里

今天的文章很水,就这样吧

参考文章


向我捐助 | 关于我 | 工作机会


@riskers riskers added the 调试 label Mar 8, 2016
@tiann
Copy link

tiann commented Mar 8, 2016

如果只用adb的话,JDK和Android SDK都不需要装;mac下直接把adb这个可执行文件copy出来就可以用,Windows下把那两个dll一起copy出来就行。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Native 大前端
Projects
None yet
Development

No branches or pull requests

2 participants