YouTubeData API を使用してアプリケーションをビルドしようとすると、「:app:packageAllDebugClassesForMultiDex」エラーが発生します。このエラーをカバーする他のいくつかのスレッドを調査したところ、ビルド ファイルに重複した参照を作成しているライブラリがビルド ファイルにあるという結論に達しました。エラーを引き起こしているファイルは次のとおりです。
「com/google/api/client/googleapis/json/GoogleJsonErrorContainer.class」
ライブラリ全体を削除せずにビルドファイルから参照を除外するにはどうすればよいですか?
これは私のビルドファイルです
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "co.hannalupi.fitnessblenderapp"
minSdkVersion 16
targetSdkVersion 21
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:multidex:1.0.0'
compile 'com.android.support:appcompat-v7:22.0.0'
compile files('libs/YouTubeAndroidPlayerApi.jar')
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.google.apis:google-api-services-youtube:v3-rev136-1.20.0'
}
これは私が得るエラーです:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:packageAllDebugClassesForMultiDex'.
> java.util.zip.ZipException: duplicate entry: com/google/api/client/googleapis/json/GoogleJsonErrorContainer.class
私はAndroidが初めてです。あなたが私を指摘できる方向性は大歓迎です。前もって感謝します。