问题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
原因:工程有缓存
解决方案:
在工程上点击右键,选择properties
在Android中不要选中 Is Library,并且Remove里面的所有东西,选择自己用的就ok了。
问题4:the selected device is incompatible
问题原因:设备未连接。
原因:测试设备的ip可能冲突了。
解决方案:重设测试设备的ip
本文解决了Android开发中常见的四个问题:1. 子视图已有父视图导致的错误;2. Gradle版本不兼容问题;3. Android库项目无法启动的问题;4. 测试设备不兼容的情况。

901

被折叠的 条评论
为什么被折叠?



