码迷,mamicode.com
首页 > 移动开发 > 详细

解决新版本android stuio 导入旧项目出现 Error:Access to the dex task is now impossible, starting with 1.4.0 错误

时间:2016-04-26 10:52:40      阅读:210      评论:0      收藏:0      [点我收藏+]

标签:

关于此错误的出现的原因,请参照这篇微博http://www.05935.com/83/1036608/

 使用Android Studio 2.0 引入老项目时,在开启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

  这个问题困扰了我好久,终于有了答案。

  对于使用 gradle 2.2.1至2.9 版本的项目是无法使用Instant Run的,原因在于 Instant Run 需要使用 2.0.0的 Android Gradle Plugin:(现在2.0.0还是 alpaha 版)

技术分享

  但是,Android Gradle Plugin 从1.5.0开始就完全取消了Transform API,老项目还是使用了这个API,已至于项目更新后会报上文的错误。 
  详见官方文档(vpn)

  而从官方文档得知,使用 2.0.0的Android Gradle Plugin版本是支持1.5.0 的Android Gradle Plugin版本地,而不支持1.3.1以下版本 
  Gradle官方文档(vpn) 
技术分享 
换句话说就是目前为止只有使用的是 1.5.0 版本的项目才可以开启 Instant Run,而使用1.3.1及以下版本的项目与无法开启Instant Run

 

 

解决办法================>:

百度Google均无效后,我多方折腾后找到解决办法。

就是,在导入旧项目后,android studio提示你升级项目,升级Instant,千万不要点升级,点击取消,然后继续使用老版本的instant即可。

如果你已经点击了升级,那就只有将项目恢复到旧版本,然后再导入一次了。亲测有效!

解决新版本android stuio 导入旧项目出现 Error:Access to the dex task is now impossible, starting with 1.4.0 错误

标签:

原文地址:http://www.cnblogs.com/lanlengran/p/5434096.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!