将公司的主要项目从eclipse迁移到android studio for mac环境(2)

1.将eclipse 的 代码迁移到android studio的过程中,现在已经有了一个未优化版本能够在android studio使用,这时候,只需要将已优化版本的代码中的libs  res  src 三个文件里面的内容覆盖到未优化版本中。

但是遇到一个问题,就是资源文件出错的问题

现在发现一些资源文件出错,会在gradule console 提示,但也存在不提示的问题,只是提示下面的语句:

Error:Execution failed for task ':app:dexDebug' .com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Users/Jude/Library/Android/sdk/build-tools/23.0.2/aapt' finished with non-zero exit value 1


这个时候,由于没有提示其他错误,我选择了逐个部分的代码迁移。迁移一部分,就使用clean project 来查看代码是否能够build成功。

先选择libs ,然后src,到res各部分。

最后发现,是res的一个资源文件出现错误,最后改正。

可以看出android  studio的gradule console 也会有不能提示的问题。

2.在迁移成功后,运行出现这个问题:

Android Studios RuntimeException: Unexpected exception in dex writer thread



这个时候我通过stack overflow ,查看到可以这样解决问题,在build.gradule
中添加:
dexOptions {
    incremental true
    javaMaxHeapSize "4g"
}
最后成功了

原文地址:https://www.cnblogs.com/gengen1990/p/5805129.html