android开发错误集锦

本文档总结了Android开发过程中常见的错误,包括签名文件缺失、Gradle同步失败、UI组件非法状态更改、并发修改异常等问题,并提供了详细的解决步骤。

  Error:Execution failed for task ':app:validateSigningBaiduDebug'.
  > Keystore file          D:\project_space\AgronetByGit3.08\app\Users\xiaoxian\Desktop\Agronet_andriod\AgronetByGit3.08\Agronet_Android.keystore not    found for signing config 'debug'.


原因是:缺少签名文件或签名问文件路径有错    ----------------------------------- >在android studiofile--->projecte structure ----------->app-------->signing------->store fie指定                     正确的签名文件路径即可

二:Gradle sync failed:Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.
For example, an unrecognized jvm option is used.
Please refer to the user guide chapter on the daemon at https://docs.gradle.org/3.3/userguide/gradle_daemon.html
Please read the following process output to find out more:
-----------------------
Error occurred during initialization of VM
Could not reserve enough space for 1572864KB object heap
Consult IDE log for more details (Help | Show Log)

原因:Gradle Property的内存空间分配不够  -----------------> 修改内存配置如下同步即可:
org.gradle.jvmargs=-Xmx536m -XX:MaxPermSize=536m
三:        Process: com.sunstar.cloudseeds, PID: 14437
                                                                        java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
需要移除父节点的子节点view
方法:if(parent!=null){parent.removeAllView();}
parent.addView(view);
四:Exception in thread "main" java.util.ConcurrentModificationException
    这个错误是在遍历数据集时,删除该集合的元素,数据集长度没有刷新,导致遍历无法确定该数据集合的长度,因此报错
    解决方法:方法1.新建一个集合存储可能要删除的数据,以原集合为遍历的对象即可解决
                 List<String> aa=new ArrayList<>();
                 List<String> bb = new ArraList<>();
                 bb.addAll(aa);
                 for(int i=0;i<aa.size();i++){
                      String s=bb.get(i);
                     if(s1.equals(s)){
                       
bb.remove()
                         }
                 }
             方法2.以原集合为遍历对象,每次移除原集合的元素后,刷新数据在执行遍历(这种方法我没试,理论上可以)
                   每次remove后,调用notify();刷新数据集
五:Caused by: libcore.io.ErrnoException: fcntl failed: EAGAIN (Try again)
    AndroidStudio 编译异常java.lang.OutOfMemoryError: GC overhead limit exceeded
    一碰到这样就脑袋大,错误无从下手,终于在google有人回答了这个,在build.gradle中的android{}添加如下脚本就可以顺利编译了 
dexOptions { 
incremental true 
javaMaxHeapSize “4g” 
}
六.解决 app:transformClassesWithDexForDebug 错误

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值