记录一下自己在安卓开发中遇到的问题以及解决方案。
1.USB设备无法识别问题
网上下载一个手机助手类的应用,让它连上手机,然后它就会帮你把手机的驱动安装好了,打开USB调试,进入Android Studio,运行程序,成功了!
2.setSupportActionBar报错
方法参数报错
把import android.widget.Toolbar
更换成
Import android.support.v7.widget.Toolbar
3.Error:The supplied javaHome seems to be invalid. I cannot find the java executable. Tried location: D:\android\android-sdk-windows\bin\java.exe
使用AndroidStudio打开项目后,依次点击
1、File
2、Project Structure
3、在JDK Location中,选择JDK8的位置
4.使用WebView加载网页的时候图片不显示(我手机系统是5.1.1)
if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.LOLLIPOP) {
settings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLAW);
}
5.Binary XML file line #0: Attempt to invoke virtual method 'boolean java.lang.String.equals
检查一下布局里面的View标签,首字母要大写,有时候会注意不到。
6.Cause:org.jetbrains.plugins.gradle.tooling.util.ModuleComponentIdentifierImpl.getModuleIdentifier()Lorg/gradle/api/artifacts/ModuleIdentifier;
gradle版本不兼容
7.编译出现问题,cannot start process, the working directory ""does not exist
在Run-Edit Configuration-Working directory选择
M
O
D
U
L
E
D
I
R
MODULE_DIR
MODULEDIR
点击apply ok
8.Could not determine jdk
解决方法:尝试升级gradle版本
如下是类似问题:
I can’t find java home
设置里面修改gradle jvm
9. adb.exe 已停止工作解决办法
一般出现这个错误的原因都是由于adb的默认端都5037,被其他程序占用了。
解决方法:
1.在命令行界面输入netstat -aon|findstr “5037”,查看哪个程序占用了这个端口
2.根据上一步得到的PID,在任务管理器关闭之
10.Plugin supporting feature (Facet[android]) is currently disabled
方法:左上角File >> Setting >> Plugins >> 把Android Support勾选上,点击Apply,再点OK,会提示重启,重启完就好了。