com.android.dex.DexException:多个dex文件定义Lcom / google / android / gms / location / places / PlaceReport;

时间:2017-05-12 20:55:58

标签: java android gradle libraries

在gradle中,我添加了以下依赖项,这些依赖项已同步!

apply plugin: 'com.android.application'

android {
compileSdkVersion 22
buildToolsVersion "22.0.1"

defaultConfig {
    applicationId "com.example.panagiotis.lalakis"
    minSdkVersion 16
    targetSdkVersion 22
    versionCode 1
    versionName "1.0"

}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
  }
}

 dependencies
      {
            compile fileTree(dir: 'libs', include: ['*.jar'])
            compile 'com.android.volley:volley:1.0.0'
            compile 'com.android.support:appcompat-v7:22.2.1'
            compile 'com.google.android.gms:play-services-maps:9.4.0'
            compile 'com.google.android.gms:play-services-location:8.4.0'
            compile 'com.google.maps.android:android-maps-utils:0.5'
    }

编码过程中没有标记错误,但是当我尝试构建项目时 得到以下错误

 com.android.dex.DexException: Multiple dex files define 
 Lcom/google/android/gms/location/places/PlaceReport;

我知道存在冲突,但我不知道如何修复它,在线文章很少,而且对我的问题没有启发性。有人可以建议我一个解决方法吗?提前感谢Panos!

1 个答案:

答案 0 :(得分:0)

对地图和位置使用相同的版本:

  dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        compile 'com.android.volley:volley:1.0.0'
        compile 'com.android.support:appcompat-v7:22.2.1'
        compile 'com.google.android.gms:play-services-maps:9.4.0'
        compile 'com.google.android.gms:play-services-location:9.4.0'
        compile 'com.google.maps.android:android-maps-utils:0.5'
  }