升级到Android Studio到2.0预览并使用Instant Run后出现Gradle错误

时间:2015-11-24 09:50:00

标签: android android-studio gradle dex

当我尝试运行在Android Studio 1.5上运行良好的项目时,我收到以下错误:

Error:Access to the dex task is now impossible, starting with 1.4.0
1.4.0 introduces a new Transform API allowing manipulation of the .class files.
See more information: http://tools.android.com/tech-docs/new-build-system/transform-api

我在这里看到了一些关于此错误的问题,但所有答案都是将Gradle降级为1.3版本,我可以使用新的Android Studio和Instant Run选项。

这个问题有另一个解决方案吗?

1 个答案:

答案 0 :(得分:3)

我能够通过扩大build.gradle中的最大堆大小来解决这个问题 将此添加到您的android闭包中:

 dexOptions {
    javaMaxHeapSize "4g"
 } 

不确定它与新api有什么关系