android - android studio将字节码转换为dex时出错

标签 android android-studio gradle android-gradle-plugin

我将一个现有项目导入到我的android studio中,一切似乎都还可以,但是当我尝试使用数据电缆和android手机运行代码时,却多次得到此错误消息:

Error:Error converting bytecode to dex: Cause: java.lang.RuntimeException: Exception parsing classes

最佳答案

您可以尝试multidex

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"

         defaultConfig {
             minSdkVersion 15 //lower than 14 doesn't support multidex
             targetSdkVersion 25

             // Enabling multidex support.
             multiDexEnabled true       //You have already did this 
         }
}


dependencies {
    compile 'com.android.support:multidex:1.0.1'   // add this in  dependencies
}

您也可以尝试清理项目并重建项目,希望可以解决您的问题。

关于android - android studio将字节码转换为dex时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45204675/

相关文章:

android - Linux 操作系统和移动操作系统 (android) 之间的根本区别

android - 在哪里下载 Eclipse?

Android Studio 更改 xml 代码样式问题

git - 重新创建Android项目后如何 merge Git存储库?

gradle - 使用 gradle 设置 kotlin 项目

android - Gradle会返回错误的resValue,但并非总是如此

android - 授权和捕获在 paypal sdk for android 中可行吗?

php - Android 到 php 发送 UTF8 编码文本,不适用于西里尔文或阿拉伯文字符

gradle - 如何运行 gradle Web 应用程序?

Android Content Provider 与 SharedPreferences