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

Emi*_*Adz 6 android gradle dex android-studio

当我尝试运行在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
Run Code Online (Sandbox Code Playgroud)

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

还有另一个解决这个问题的方法吗?

zwe*_*bie 3

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

 dexOptions {
    javaMaxHeapSize "4g"
 } 
Run Code Online (Sandbox Code Playgroud)

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