Android问题集锦

来源:互联网 发布:md5加密java代码百度云 编辑:程序博客网 时间:2024/04/29 12:20

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

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

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

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


2 0