解决Mac上adb: command not found问题

使用mac进行开发的时候,有时候需要使用adb指令来进行一些操作,但是如果没有配置过Android环境变量,可能会出现adb: command not found的问题,查了一些资料,这里记录一下mac上配置Android环境变量的方法:

  1. 打开mac的terminal终端,输入 cd ~/ 【进入当前用户的home目录】
  2. 输入 touch .bash_profile 【如果没有.bash_profile这个文件,则创建一个这个文件】
  3. 输入 open .bash_profile 【打开我们创建的这个文件,此时应该弹出一个文本编辑框,如果是第一次配置环境,那么文本编辑框为空白】
  4. 在打开的文本编辑器中写入如下代码

 export ANDROID_HOME=/usr/local/opt/android-sdk

export PATH=${PATH}:${ANDROID_HOME}/tools

export PATH=${PATH}:${ANDROID_HOME}/platform-tools


  1. 注意4中的ANDROID_HOME应该根据自己的sdk路径来填写,其余可以直接复制。至于sdk路径,可以打开Android Studio,在preference(Windows的setting)中搜索sdk来查看。
  2. 在终端中输入 source .bash_profile 【使我们的改动生效】
  3. 输入 adb 【验证是否完成配置,如果不显示 adb: command not found,说明配置完成 】

1、确保连接线没问题,连接好后。查看usb设备信息,终端输入命令

      system_profiler SPUSBDataType

获取adnroid机的设备信息,红色部分稍后要用 
这里写图片描述

1)方法:下载一个 androidfiletransfer.dmg,安装之后,看看能不能读取手机数据,如果能够读取,好的,恭喜你,第一步完成了。

2)

其中的 vendor ID: 0x18d1 很重要,记下来

 

第二步: 创建、修改adb_usb.ini文件

输入: vi ~/.android/adb_usb.ini 命令,在打开的 adb_usb.ini文件中添加0x18d1, (然后保存退出,直接输入:wq即可)

 

 

来源:网络


智能推荐

mac adb shell -bash: adb: command not found, adb配置

mac系统首次使用adb时报错,是因为需要配置一下tools,  使用mac进行开发的时候,使用adb指令来进行一些操作,没有配置过Android环境变量,会出现adb: command not found的问题,需要在mac上配置Android环境变量: 操作步骤: 1. 打开mac的terminal终端,输入 cd ~/ 【进入当前用户的home目录】 2. 输入 touch .ba...

Mac mvn : command not found

  去/usr/local目录下面(可以打开Finder command+shift+G),把解压出来的文件拷贝到这个目录下面 /usr/local/apache-maven-3.6.3 1、$ sudo vi ~/.bash_profile 添加如下配置: JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_251.jdk/Cont...

Android Studio(for mac) adb 命令command not found

1.找到android sdk的本地路径, 提供一种方案: 在finder里 前往 ,输入~/library 打开adb查看地址: 打开adb,拉到上方查看地址 2.打开终端输入 touch .bash_profile    open -e .bash_profile  点回车 3.添加路径 .bash_profile打开了,我们在这里添加路径, 如果打开的...

解决Linux出现类似xxxx:command not found的问题

事件背景 我今天在国外某网站上买了一个海外的Centos的服务器,为了搭建一个东西,然后查寻相关信息的时候,出现了-bash: ifconfig: command not found的错误提示 当时我就满脑子问号,为什么以前刚学Linux时候的基本命令居然用不了 当然我知道这个错误提示是什么意思,就是没有安装这个命令或者程序 但是让我不解的是为什么这种基本命令会没有安装,就像ls、cd等命令一样 ...

sudo: pip:command not found问题解决

@[TOC]sudo: pip:command not found问题解决 sudo: pip:command not found问题解决 python3 centos7 yum install python3-pip 安装成功...

猜你喜欢

解决Linux出现类似xxxx:command not found的问题

事件背景 我今天在国外某网站上买了一个海外的Centos的服务器,为了搭建一个东西,然后查寻相关信息的时候,出现了-bash: ifconfig: command not found的错误提示 当时我就满脑子问号,为什么以前刚学Linux时候的基本命令居然用不了 当然我知道这个错误提示是什么意思,就是没有安装这个命令或者程序 但是让我不解的是为什么这种基本命令会没有安装,就像ls、cd等命令一样 ...

解决Linux “g++: Command not found“报错问题

报错提示:"g++: Command not found" 报错原因:缺少组件导致的 解决步骤: 1、通过 yum search "gcc-c++" 命令检查缺少组件的版本,毕竟不同系统需要安装的版本是不同的。 2、安装对应版本 yum install "gcc-c++.x86_64" -y 参考链接:https://www.l...

mkvirtualenv: command not found 问题解决

我的系统:Ubuntu16.04 python版本:python 3.5.2 问题:mkvirtualenv: command not found 在新买的腾讯云家目录下创建目录:Project,创建 python 虚拟环境,使用 mkvirtualenv django01 -p python3 命令,没有提示,输完命令回车报以下错误: mkvirtualenv: command not foun...

博客园 新随笔 联系 管理 VisionPro工业视觉的标定方法

工业视觉常用的几种标定方式。 计算像素比 有些时候我们需要的检测数据并不需要特别准确,并且手边没有其它标定工具,可以使用这种方法大概算一算每个像素对应多大距离。 找一个知道距离的物体,测出它的像素距离,像素比例=被测物体距离÷像素大小 相机固定--平台移动的标定 这种方式需要被测物体固定在可以改变位置的移动平台上。 采用4点标定法,在物体所在图像中心拍照取一个点,命名为(0,0),记...

【JY】No.7.3力学架构Abaqus结构智能选型教程

   Abaqus结构智能选型 本例以下面这个赛题为例,存在一个中部拟集中荷载的结构,欲求最优效率的受力方案,该例子可以供读者思考和学习,研读第三章中的概念设计,类似于力流的分析,有助于力学架构设计的方案设计。 第一步:根据题目进行结构建模 打开Abaqus软件,并开始对结构外围条件进行建模: 填写题目规定的结构长度: 生成结构,如下图所示: 第二步:填写材料本构 如下点击,并...

问答精选

How to print screen Visual Studio IDE including tooltip/intellisense?

Here is a printscreen of a tooltip/intellisense that is there before and after I hit the printscreen key. Here is a an image from my camera. Have also tried delayed printscreen with count down using 3...

referencing an image from php

I have a function on a website where I have a img reference leading to a php page which I need to return an image and update a database file I figured this would not work as I am referencing a php pag...

Location of entrust roles and permissions code

I am new to Laravel and trying to use enrtust plugin for roles and permissions, but when following the instructions in the documentation, I reached the bit where I have to put the code that creates th...

php mysql inventory

I'm creating an app for a trading card game called Magic: the Gathering and I have made a query that checks all user-submitted decks and gives you the percentage of cards you have in your inventory ov...

How to Email NSManagedObject

I'd like to take data from my iPhone app, and allow users to email it to other users of the app. I have the app data stored as an array of NSManagedObjects in CoreData. What is the best way to take th...

相关问题

相关文章

热门文章

推荐文章

相关标签

推荐问答