android - 现在无法访问dex任务,如何升级到1.5.0?

标签 android gradle android-gradle-plugin build.gradle dex

我想将 gradle 升级到 2.0.0-beta 或 1.5.0,目前我的 gradle 中有 dex 插件,但即使我删除了它,我仍然遇到同样的错误。我如何正确摆脱 multidex 依赖

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

build.gradle More info on multidex

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.0"

    defaultConfig {
        ...
        minSdkVersion 14
        targetSdkVersion 21
        ...

        // Enabling multidex support.
        multiDexEnabled true
    }
    ...
}

dependencies {
  compile 'com.android.support:multidex:1.0.0'
}

Transform API 不会提供太多信息。 有没有什么可以让这项工作或任何示例如何使用转换 api,任何东西?

我知道它适用于 1.3.0,我至少需要 1.5.0

最佳答案

在项目级别build.gradle,把这个(或任何你需要的版本)

 dependencies {
     classpath 'com.android.tools.build:gradle:1.5.0'
 }

至于

How do I properly get rid of the multidex dependency?

您需要删除 Gradle 文件中对 multidex 的所有引用,然后同步 Gradle 并清理并重建项目

关于android - 现在无法访问dex任务,如何升级到1.5.0?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36344183/

相关文章:

android - 由于网络政策存在问题,我的应用被 Google Play 拒绝了?

java - Gradle不显示在Eclipse导入向导中

android - 使用 multidex 和 Dagger 2 时,Application 对象中缺少函数

android - Android Gradle插件:在DexOptions上找不到方法AdditionalParameters()

android - 在父 View 中处理触摸但在 subview 中处理单击事件

java - 尝试调用虚拟方法 'android.text.Editable android.widget.EditText.getText()'

java - 使用最新的 Jackson Parser 库在 Android 设备上解析 JSON

windows - 运行Gradle应用分发时的编码问题

android - 如何在gradle文件中使用变量?

android - 错误 :Unexpected lock protocol found in lock file. 预期 3,找到 0