For the cause of this error, please refer to this Weibo http://www.05935.com/83/1036608/
When you introduce an old project using Android Studio 2.0, this problem occurs when you turn on Instant run:
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
The question bothered me for a long time and finally got the answer.
For projects that use the Gradle 2.2.1 to 2.9 version, Instant run cannot be used because Instant run requires 2.0.0 Android gradle Plugin: (now 2.0.0 or Alpaha version)
However, the Android Gradle Plugin completely canceled the transform API from 1.5.0, and the old project used the API, and the above error was reported after the project was updated.
See official documentation (VPN)
And from the official documentation, the Android Gradle plugin version of 2.0.0 is supported 1.5.0 Android Gradle plugin version, and does not support the following versions of 1.3.1
Gradle Official document (VPN)
In other words , so far only use 1.5.0 version of the project can be opened Instant run, and the use of 1.3.1 and the following version of the project and cannot open Instant run
Solution ================>:
Baidu Google are invalid after I toss a few to find a solution.
is, after importing the old project, Android Studio prompts you to upgrade the project, upgrade instant, do not point to upgrade, click Cancel, and then continue to use the old version of instant.
If you've clicked on the upgrade, you'll only have to restore the project to the old version and then import it again. Pro-Test Effective!
Resolves a new version of Android Stuio import old item appears error:access to the Dex task was now impossible, starting with 1.4.0 error