安卓问题集锦

来源:互联网 发布:监听rpc服务器端口 编辑:程序博客网 时间:2024/05/01 00:11

问题1:The specified child already has a parent. You must call removeView()

原因:一个孩子只能有一个父亲,在调用的过程中同一个孩子出现了两个父亲。

解决方案:在添加视图之前断除孩子和其他父亲的关系。

?
1
2
3
4
5
ViewGroup  viewParent = (ViewGroup)pauseLinearLayout.getParent();
if(viewParent != null) {
    viewParent.removeAllViewsInLayout();
}
layoutLoading.addView(pauseLinearLayout);

问题2:the project system may be using a version of Gradle that does not contain the method

解决方案:删除build.gradle里面的:

{      compileSdkVersion 17      buildToolsVersion '18.1.0'    }    dependencies {    }

问题3:andriod library projects cannot be launched

原因:工程有缓存

解决方案:

  1. 在工程上点击右键,选择properties

  2. 在Android中不要选中 Is Library,并且Remove里面的所有东西,选择自己用的就ok了。


问题4:the selected device is incompatible

问题原因:设备未连接。

原因:测试设备的ip可能冲突了。

解决方案:重设测试设备的ip

———————————————————————————————————————————————————————————————

问题5:R文件无法找到

原因:android.jar没有找到

解决方案:添加android.jar到工程中。

例如;在android studio中如此添加


在Android studio中,对于同一个工作区间而言,是不允许jar包重复的,这和eclipse是不同的,所以尤其注意在添加依赖包的时候,不要添加冲突。

2 0
原创粉丝点击