Gradle正在建设,但我的apk没有建设。以下是调试报告

时间:2018-04-25 11:43:37

标签: android android-layout android-studio android-gradle

错误:将字节码转换为dex时出错:     原因:com.android.dex.DexException:多个dex文件定义     LCOM /安卓/抽射/ VolleyError;     错误:任务':app:transformClassesWithDexForDebug'执行失败。

  

com.android.build.api.transform.TransformException:com.android.ide.common.process.ProcessException:java.util.concurrent.ExecutionException:com.android.ide.common.process.ProcessException:执行时出错带有参数的主要类com.android.dx.command.Main的java进程{--dex --num-threads = 4 --output C:\ Users \ Admin \ Downloads \ Compressed \ android-project-master \ android-project -master \ FuraFilaRestaurante \ app \ build \ intermediates \ transforms \ dex \ debug \ folders \ 1000 \ 1f \ main C:\ Users \ Admin \ Downloads \ Compressed \ android-project-master \ android-project-master \ FuraFilaRestaurante \ app \ build \ intermediates \ pre-dexed \ debug \ debug_8aeaaafa5c6d5384bfd454910cc83d5ff83fa840.jar C:\ Users \ Admin \ Downloads \ Compressed \ android-project-master \ android-project-master \ FuraFilaRestaurante \ app \ build \ intermediates \ pre-dexed \ debug \ support-annotations-23.0.0_0dab550717daaa39038e18a12569b8e6e59c66a3.jar C:\ Users \ Admin \ Downloads \ Compressed \ android-project-master \ android-project-master \ FuraFilaRestaurante \ app \ build \ intermediates \ pre-dexed \ debug \ classes_ef825ab67fb07bdeb9a193454b1d86c34a6de410.jar C:\ Users \ Admin \ Downloads \ Compressed \ android-project-master \ android-project-master \ FuraFilaRestaurante \ app \ build \ intermediates \ pre-dexed \ debug \ internal_impl-23.0.0_4fd9037368ca1910431d60d68541b9cbe7359db9.jar C:\ Users \ Admin \ Downloads \ Compressed \ android-project-master \ android-project-master \ FuraFilaRestaurante \ app \ build \ intermediates \ pre-dexed \ debug \ library-1.0.19_725edc60641ff5dbb87f7858f19da7a143a493d1 .jar C:\ Users \ Admin \ Downloads \ Compressed \ android-project-master \ android-project-master \ FuraFilaRestaurante \ app \ build \ intermediates \ pre-dexed \ debug \ classes_f9e2c446de8e342bd59b5e7a7d604b3f69ad8d54.jar C:\ Users \ Admin \ Downloads \压缩\机器人项目主\机器人项目主\ FuraFilaRestaurante \应用\构建\中间体\预dexed \调试\ volley_7e1221791a2312310bbb4be60825742b2761dd4a.jar}

    this app gradle file
apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion '25.0.0'

defaultConfig {
    applicationId "furafila.furafilarestaurante"
    minSdkVersion 15
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 
  'proguard-rules.pro'
    }
   }
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.0.0'
compile files('libs/volley.jar')
compile 'com.mcxiaoke.volley:library:1.0.19'

}

2 个答案:

答案 0 :(得分:2)

  

多个dex文件定义Lcom / android / volley / VolleyError;

compile files('libs/volley.jar')
compile 'com.mcxiaoke.volley:library:1.0.19'

build.gradle 部分中的两个相同的库。删除其中一个

注意

您应该使用volley版本,因为 com.mcxiaoke 已被弃用。

 compile 'com.android.volley:volley:1.1.0'

答案 1 :(得分:1)

在defaultConfig

中添加 multiDexEnabled true

喜欢这个

 defaultConfig {
        applicationId "furafila.furafilarestaurante"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }