android开发错误集锦

版权声明:未经准许,不得私自转载! https://blog.csdn.net/Pusherson/article/details/77847208

  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 错误

猜你喜欢

转载自blog.csdn.net/Pusherson/article/details/77847208