调试问题杂记

1.Unable to find the layout for Action Bar.

切换编辑主题

2.adb server version (31) doesn't match this client (36); killing...
error: could not install *smartsocket* listener: cannot bind to 127.0.0.1:5037:
通常每个套接字地址(协议/网络地址/端口)只允许使用一次。 (10048)

卸载360手机助手

3.Connecting to the target VM, address: 'localhost:8600', transport: 'socket'

in android studio: tools->android->enable adb integration(this should be checked) uncheck this, then check again. this solved me this problem. (it restarts the adb integration)

4.

uiautomatorviewer。第一次使用出现报错:Unable to connect to adb. Check if adb is installed correctly。

解决办法如下:

1、打开uiautomatorviewer.bat,找到uiautomatorviewer.bat文件最后一行:

call "%java_exe%" "-Djava.ext.dirs=%javaextdirs%" "-Dcom.android.uiautomator.bindir=%prog_dir%" -jar %jarpath% %*

2、将  %prog_dir%  修改为SDK的platform-tools所在路径。

3、修改后的最后一行为:

call "%java_exe%" "-Djava.ext.dirs=%javaextdirs%" "-Dcom.android.uiautomator.bindir=D:\AndroidSDK\platform-tools" -jar %jarpath% %*

4、再次启动工具uiautomatorviewer:

 

 

5.Android Studio 加入aar 资源包 报Failed to resolve:

repositories{
    flatDir{
        dirs 'libs'
    }
}
添加 aar资源包报Failed to resolve:xxxx,则需要build.gradle 添加上述代码块

6.Cannot find System Java Compiler. Ensure that you have installed a JDK (not just a JRE) and configured your JAVA_HOME system variable to point to the according directory.

详细报错信息如下

Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
> Cannot find System Java Compiler. Ensure that you have installed a JDK (not just a JRE) and configured your JAVA_HOME system variable to point to the according directory.

原因

  你要导入项目的gradle版本不对,要么过高要么过低,建议将gradle版本改为新建项目的gradle版本

解决方案

  在找到project下面的build.gradle,修改gradle版本。如果不知道具体是哪个版本,可以直接复制新建项目的build.gradle版本。比如:将classpath ‘com.android.tools.build:gradle:1.3.0’修改为classpath ‘com.android.tools.build:gradle:2.2.3’


posted @ 2017-07-20 16:54  Holyday  阅读(225)  评论(0编辑  收藏  举报