I am using YouTubeAndroidPlayerApi in my project to play the youtube video through the Video ID. Everything works fine but except the issue that am facing while after enabling the proguard minifyEnabled true
in my build.gradle
. Please find my build.gradle
configuration that I am using for proguard and error in the logcat as follows for your reference.
build.gradle
apply plugin: 'com.android.library'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
minSdkVersion 19
targetSdkVersion 23
versionCode 1
versionName "1.0"
consumerProguardFiles 'proguard-rules.txt'
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
}
dependencies {
compile 'com.google.android.gms:play-services-gcm:8.3.0'
compile files('lib/YouTubeAndroidPlayerApi.jar')
}
Logcat Error:
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/youtube/player/YouTubePlayerView.class
Note: The above error is occuring only when i enable proguard from minifyEnabled false
to minifyEnabled true
What I tried:
I tried adding -keeppackagenames com.google.android.youtube.** { *; }
in my proguard-rules.pro
but none of the solution worked for me. Please help. Any kind of tips and suggestions would be very helpful to me. Thanks in advance.