多个dex文件定义错误

时间:2015-05-22 17:20:10

标签: android android-studio gradle

我知道这个问题已被问过很多次,但所提供的解决方案都没有对我有用,因此我要问一个新问题。将项目从Eclipse导入Android Studion后,我收到了上述错误。下面是我的build.gradle文件。正如您所看到的,我已经评论了大多数我的库,但仍然没有解决方法。在此先感谢您的帮助。

apply plugin: 'com.android.application'

android {
compileSdkVersion 22
buildToolsVersion "22.0.1"

aaptOptions.cruncherEnabled = false
aaptOptions.useNewCruncher = false

compileOptions {
    encoding "UTF-8"
    sourceCompatibility JavaVersion.VERSION_1_7
    targetCompatibility JavaVersion.VERSION_1_7
}
defaultConfig {
    applicationId "com.xxx.yyy"
    minSdkVersion 14
    targetSdkVersion 22
}

buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
    }
  }
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.http-client:google-http-client-gson:1.20.0'
compile 'com.google.code.gson:gson:2.3'
compile 'com.google.guava:guava:18.0'
compile 'joda-time:joda-time:2.7'
//compile files('libs/google-api-client-1.19.1.jar')
//compile files('libs/google-api-client-android-1.19.1.jar')
compile files('libs/google-api-services-youtube-v3-rev126-1.19.1.jar')
//compile files('libs/google-http-client-1.19.0.jar')
//compile files('libs/google-http-client-android-1.19.0.jar')
//compile files('libs/google-http-client-jackson2-1.17.0-rc.jar')
compile files('libs/google-oauth-client-1.17.0-rc.jar')
//compile files('libs/google-oauth-client-java6-1.17.0-rc.jar')
//compile files('libs/google-oauth-client-jetty-1.17.0-rc.jar')
//compile files('libs/google-oauth-client-servlet-1.17.0-rc.jar')
compile files('libs/jackson-core-2.1.3.jar')
//compile files('libs/Parse-1.9.1.jar')
compile 'com.parse.bolts:bolts-android:1.1.2'
compile files('libs/picasso-2.3.4.jar')
compile files('libs/twitter4j-core-4.0.2.jar')
compile files('libs/YouTubeAndroidPlayerApi.jar')
compile 'com.android.support:appcompat-v7:22.1.1'
compile project(':CircularImageView')
//compile files('libs/google-play-services.jar')
compile 'com.google.android.gms:play-services-base:7.3.0'
//compile 'com.google.android.gms:play-services-plus:7.3.0'
compile project(':CountryPicker')
compile project(':PullToRefreshListView')
compile('com.facebook.android:facebook-android-sdk:3.22.0@aar') {
    exclude module: 'support-v4'
    exclude module: 'bolts'
}
}

我收到的错误:

com.android.dex.DexException: Multiple dex files define Lcom/google/api/client/util/StreamingContent

1 个答案:

答案 0 :(得分:0)

感谢@Gabriele的指示。我通过删除google-api-client-1.19.1.jar解决了这个问题,虽然它被注释掉了,但它仍然存在于libs文件夹中,所以我不得不从项目中手动删除它。当我从AS终端运行gradle -dependencies时,我知道了这一点。