即时无法在Android Studio 3.0中运行

ved*_*ant 7 android android-studio

我正在DexArchiveBuilderException使用Android studio 3.0进行即时运行.Gradle构建正常,但是在尝试部署时遇到错误apk.

禁用即时运行可修复此问题.

如何通过即时运行实现这一目标?

完整错误:

Error:com.android.builder.dexing.DexArchiveBuilderException: Failed to process /Users/vedantagarwala/dunzo/cappuccino/android-final/demo/build/intermediates/transforms/instantRunSlicer/debug/9
Run Code Online (Sandbox Code Playgroud)

//顶级构建文件:

buildscript {
    repositories {
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0'
        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7'
        classpath 'com.github.dcendents:android-maven-plugin:1.2'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

ext {

    compileSdkVersion = 27
    buildToolsVersion = "26.0.2"

    targetSdkVersion = 22
    minSdkVersion = 15
    androidSupportLibVersion = "25.3.1"
    googlePlayServiceVersion = "10.0.1";
    resConfigs = ["en"];
    // You can also create properties to specify versions for dependencies.
    // Having consistent versions between modules can avoid conflicts with behavior.
}
Run Code Online (Sandbox Code Playgroud)

我已经尝试过在线解决方案,比如升级/降级gradle和/或依赖项,但没有任何效果.

JDK:

$ java -version
openjdk version "1.8.0_152-release"
OpenJDK Runtime Environment (build 1.8.0_152-release-915-b08)
OpenJDK 64-Bit Server VM (build 25.152-b08, mixed mode)
Run Code Online (Sandbox Code Playgroud)

Kir*_*iya 2

如果您的设备运行的是 MIUI,请进入开发者设置 -> 打开 MIUI 优化并将其关闭。然后你需要重新启动你的设备并重新编译代码。Instant Run 应该会再次启动并运行!