mac 新版android studio 找不到DDMS及monitor打开白屏或报错问题

导致原因:
1、Jdk版本不一致
2、本地存在两个jdk虽然在控制台看到是 jdk1.8.0_144但是默认的还是存在的高版本
解决方案:换 jdk1.8.0_144 就可以了,具体操作看下面日志。

mac配置jdk环境方案:
如果你是第一次配置环境变量,可以使用“touch .bash_profile” 创建一个.bash_profile的隐藏配置文件(如果你是为编辑已存在的配置文件,则使用"open -e .bash_profile"命令),如下面日志:

localhost:~ jeffery$ cd ~
localhost:~ jeffery$ open -e .bash_profile

里面插入

JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home
export JAVA_HOME=$JAVA_HOME

用"source .bash_profile"使配置生效。
输入 echo $JAVA_HOME 显示刚才配置的路径,如下图所示:

localhost:~ jeffery$ 
localhost:~ jeffery$ source .bash_profile
localhost:~ jeffery$ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home
localhost:~ jeffery$ 

删除多余jdk

localhost:~ jeffery$ /usr/libexec/java_home -V
Matching Java Virtual Machines (2):
    1.8.0_191, x86_64:	"Java SE 8"	/Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home
    1.8.0_144, x86_64:	"Java SE 8"	/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home

/Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home
localhost:~ jeffery$ ls
Applications			Phone V9.5.5
AwesomeProject			Pictures
Desktop				Public
Documents			fps.txt
Downloads			java_error_in_studio_4407.log
Library				java_error_in_studio_7104.log
Movies				
Music
localhost:~ jeffery$ cd Library/
localhost:Library jeffery$ cd /Library/Java/JavaVirtualMachines/
localhost:JavaVirtualMachines jeffery$ ls
jdk1.8.0_144.jdk	jdk1.8.0_191.jdk
localhost:JavaVirtualMachines jeffery$ rm jdk1.8.0_191.jdk
rm: jdk1.8.0_191.jdk: is a directory
localhost:JavaVirtualMachines jeffery$ sudo rm -r -f jdk1.8.0_191.jdk
Password:
localhost:JavaVirtualMachines jeffery$ ls
jdk1.8.0_144.jdk
localhost:JavaVirtualMachines jeffery$ java -version
java version "1.8.0_144"
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)
localhost:JavaVirtualMachines jeffery$ 

你可能感兴趣的:(常见问题)