运行时排球Android错误

时间:2017-05-23 08:56:49

标签: android-volley

先生,请帮助我,跑步时我的排球错误

这是我的Logcat 错误:任务':app:transformClassesWithDexForDebug'执行失败。

  

com.android.build.api.transform.TransformException:com.android.ide.common.process.ProcessException:java.util.concurrent.ExecutionException:com.android.dex.DexException:多个dex文件定义Lcom / android /凌空/ VolleyError;

这是我的app gradle模块

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.3"
    defaultConfig {
        applicationId "com.kalasubaindonesia.kalasubaindonesiamekanik"
        minSdkVersion 14
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support:design:25.3.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:multidex:1.0.1'`enter code here`
    compile files ('libs/volley1019.jar') // i use offline volley 
}

如何解决?谢谢

1 个答案:

答案 0 :(得分:0)

我认为这个问题与Multidex有关。你有没有尝试添加

multiDexEnabled true

进入你的defaultConfig?

您也可以在清单中添加:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.android.multidex.myapplication">
    <application
    android:name="android.support.multidex.MultiDexApplication">
    </application>
</manifest>

更多信息: https://developer.android.com/studio/build/multidex.html#mdex-gradle