I am trying to make local notifications work on android and require use of NotificationCompat which is part of android v4 support.
Hence I add library dependency of ‘com.android.support:support-v4:27.1.0’ and my dependencies are as follows
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
implementation ("com.android.support:support-v4:27.1.0")
compile (project(':libcocos2dx'))
{
exclude group: 'com.android.support', module: 'support-v4'
}
}
But when I compile I get error as follows.
Caused by: java.io.IOException: Duplicate zip entry [classes.jar:android/support/v4/media/MediaBrowserCompat$MediaItem$1.class]
at proguard.io.JarWriter.getOutputStream(JarWriter.java:138)
at proguard.io.FilteredDataEntryWriter.getOutputStream(FilteredDataEntryWriter.java:106)
at proguard.io.FilteredDataEntryWriter.getOutputStream(FilteredDataEntryWriter.java:106)
at proguard.io.FilteredDataEntryWriter.getOutputStream(FilteredDataEntryWriter.java:92)
at proguard.io.ClassRewriter.read(ClassRewriter.java:68)
at proguard.io.FilteredDataEntryReader.read(FilteredDataEntryReader.java:87)
at proguard.io.FilteredDataEntryReader.read(FilteredDataEntryReader.java:87)
at proguard.io.FilteredDataEntryReader.read(FilteredDataEntryReader.java:87)
at proguard.io.JarReader.read(JarReader.java:65)
at proguard.io.DirectoryPump.readFiles(DirectoryPump.java:65)
at proguard.io.DirectoryPump.pumpDataEntries(DirectoryPump.java:53)
at proguard.InputReader.readInput(InputReader.java:184)
... 50 more
I am not even using MediaBrowserCompat.
I am aware that some other jar is using 'v4 support ’ module but I cannot fix it.
Please help.
Update : I was finally able to fix the issue by removing ‘android-support-v4.jar’. You will find that jar under the following directory.
\cocos2d\cocos\platform\android\java\libs
Thanks.
Open the terminal and call ./gradlew projectName:dependencies, where projectName is the name while project creation. If you don’t know that name, call less settings.gradle and it is the second include line.
With the gradle call, you get a graphical overview of your dependency graph. It could be handy to write it into a text file -> ./gradlew projectName::dependencies > dep.txt. After that you can open the dep.txt with a simple text editor.
A one more thing. All com.android.support dependencies must have the same version number. If they differs, just include them under you implementation line with the same 27.1.0.
PS: If you are under Windows, your don’t need to add the ./ before gradlew and the less command could be not available (just use a editor to show the file content).
1 Like
I did as you said but ended up being confused. I found multiple entries of android support dependencies when I add a single dependency in my project gradle file. Please help me out here.
Following the output of gradlew projectName:dependencies. I also noticed several warnings and wish to remove them as well. Do notice how ‘com.android.support:support-compat:27.1.0’ is being mentioned multiple times. If I remove that dependency and check this list again, then all references to it disappear.
I did use com.android.support:support-compat:27.1.0 instead of com.android.support:support-v4:27.1.0 to remove including un-used dependencies.
Configuration 'compile' in project ':GameName' is deprecated. Use 'implementation' instead.
:GameName:dependencies
------------------------------------------------------------
Project :GameName
------------------------------------------------------------
androidJacocoAgent - The Jacoco agent to use to get coverage data.
\--- org.jacoco:org.jacoco.agent:0.7.4.201502262128
androidJacocoAnt - The Jacoco ant tasks to use to get execute Gradle tasks.
\--- org.jacoco:org.jacoco.ant:0.7.4.201502262128
+--- org.jacoco:org.jacoco.core:0.7.4.201502262128
| \--- org.ow2.asm:asm-debug-all:5.0.1
+--- org.jacoco:org.jacoco.report:0.7.4.201502262128
| +--- org.jacoco:org.jacoco.core:0.7.4.201502262128 (*)
| \--- org.ow2.asm:asm-debug-all:5.0.1
\--- org.jacoco:org.jacoco.agent:0.7.4.201502262128
androidTestAnnotationProcessor - Classpath for the annotation processor for 'androidTest'. (n)
No dependencies
androidTestApi - API dependencies for 'androidTest' sources. (n)
No dependencies
androidTestApk - Apk dependencies for 'androidTest' sources (deprecated: use 'androidTestRuntimeOnly' instead). (n)
No dependencies
androidTestCompile - Compile dependencies for 'androidTest' sources (deprecated: use 'androidTestImplementation' instead). (n)
No dependencies
androidTestCompileOnly - Compile only dependencies for 'androidTest' sources. (n)
No dependencies
androidTestDebugAnnotationProcessor - Classpath for the annotation processor for 'androidTestDebug'. (n)
No dependencies
androidTestDebugApi - API dependencies for 'androidTestDebug' sources. (n)
No dependencies
androidTestDebugApk - Apk dependencies for 'androidTestDebug' sources (deprecated: use 'androidTestDebugRuntimeOnly' instead). (n)
No dependencies
androidTestDebugCompile - Compile dependencies for 'androidTestDebug' sources (deprecated: use 'androidTestDebugImplementation' instead). (n)
No dependencies
androidTestDebugCompileOnly - Compile only dependencies for 'androidTestDebug' sources. (n)
No dependencies
androidTestDebugImplementation - Implementation only dependencies for 'androidTestDebug' sources. (n)
No dependencies
androidTestDebugProvided - Provided dependencies for 'androidTestDebug' sources (deprecated: use 'androidTestDebugCompileOnly' instead). (n)
No dependencies
androidTestDebugRuntimeOnly - Runtime only dependencies for 'androidTestDebug' sources. (n)
No dependencies
androidTestDebugWearApp - Link to a wear app to embed for object 'androidTestDebug'. (n)
No dependencies
androidTestImplementation - Implementation only dependencies for 'androidTest' sources. (n)
No dependencies
androidTestProvided - Provided dependencies for 'androidTest' sources (deprecated: use 'androidTestCompileOnly' instead). (n)
No dependencies
androidTestRuntimeOnly - Runtime only dependencies for 'androidTest' sources. (n)
No dependencies
androidTestUtil - Additional APKs used during instrumentation testing.
No dependencies
androidTestWearApp - Link to a wear app to embed for object 'androidTest'. (n)
No dependencies
annotationProcessor - Classpath for the annotation processor for 'main'. (n)
No dependencies
api - API dependencies for 'main' sources. (n)
No dependencies
apk - Apk dependencies for 'main' sources (deprecated: use 'runtimeOnly' instead). (n)
No dependencies
archives - Configuration for archive artifacts.
No dependencies
compile - Compile dependencies for 'main' sources (deprecated: use 'implementation' instead).
\--- project :libcocos2dx FAILED
compileOnly - Compile only dependencies for 'main' sources. (n)
No dependencies
debugAndroidTestAnnotationProcessorClasspath - Resolved configuration for annotation-processor for variant: debugAndroidTest
No dependencies
debugAndroidTestCompileClasspath - Resolved configuration for compilation for variant: debugAndroidTest
+--- project :libcocos2dx
+--- com.android.support:multidex-instrumentation:1.0.2
| \--- com.android.support:multidex:1.0.2
\--- com.android.support:support-compat:27.1.0
+--- com.android.support:support-annotations:27.1.0
\--- android.arch.lifecycle:runtime:1.1.0
+--- android.arch.lifecycle:common:1.1.0
\--- android.arch.core:common:1.1.0
debugAndroidTestRuntimeClasspath - Resolved configuration for runtime for variant: debugAndroidTest
+--- project :libcocos2dx
| \--- project :gps
+--- com.android.support:multidex-instrumentation:1.0.2
| \--- com.android.support:multidex:1.0.2
\--- com.android.support:support-compat:27.1.0
+--- com.android.support:support-annotations:27.1.0
\--- android.arch.lifecycle:runtime:1.1.0
+--- android.arch.lifecycle:common:1.1.0
\--- android.arch.core:common:1.1.0
debugAnnotationProcessor - Classpath for the annotation processor for 'debug'. (n)
No dependencies
debugAnnotationProcessorClasspath - Resolved configuration for annotation-processor for variant: debug
No dependencies
debugApi - API dependencies for 'debug' sources. (n)
No dependencies
debugApiElements - API elements for debug (n)
No dependencies
debugApk - Apk dependencies for 'debug' sources (deprecated: use 'debugRuntimeOnly' instead). (n)
No dependencies
debugCompile - Compile dependencies for 'debug' sources (deprecated: use 'debugImplementation' instead). (n)
No dependencies
debugCompileClasspath - Resolved configuration for compilation for variant: debug
+--- project :libcocos2dx
+--- com.android.support:multidex:1.0.2
\--- com.android.support:support-compat:27.1.0
+--- com.android.support:support-annotations:27.1.0
\--- android.arch.lifecycle:runtime:1.1.0
+--- android.arch.lifecycle:common:1.1.0
\--- android.arch.core:common:1.1.0
debugCompileOnly - Compile only dependencies for 'debug' sources. (n)
No dependencies
debugImplementation - Implementation only dependencies for 'debug' sources. (n)
No dependencies
debugMetadataElements - Metadata elements for debug (n)
No dependencies
debugProvided - Provided dependencies for 'debug' sources (deprecated: use 'debugCompileOnly' instead). (n)
No dependencies
debugRuntimeClasspath - Resolved configuration for runtime for variant: debug
+--- project :libcocos2dx
| \--- project :gps
+--- com.android.support:multidex:1.0.2
\--- com.android.support:support-compat:27.1.0
+--- com.android.support:support-annotations:27.1.0
\--- android.arch.lifecycle:runtime:1.1.0
+--- android.arch.lifecycle:common:1.1.0
\--- android.arch.core:common:1.1.0
debugRuntimeElements - Runtime elements for debug (n)
No dependencies
debugRuntimeOnly - Runtime only dependencies for 'debug' sources. (n)
No dependencies
debugUnitTestAnnotationProcessorClasspath - Resolved configuration for annotation-processor for variant: debugUnitTest
No dependencies
debugUnitTestCompileClasspath - Resolved configuration for compilation for variant: debugUnitTest
+--- project :libcocos2dx
\--- com.android.support:support-compat:27.1.0
+--- com.android.support:support-annotations:27.1.0
\--- android.arch.lifecycle:runtime:1.1.0
+--- android.arch.lifecycle:common:1.1.0
\--- android.arch.core:common:1.1.0
debugUnitTestRuntimeClasspath - Resolved configuration for runtime for variant: debugUnitTest
+--- project :libcocos2dx
| \--- project :gps
\--- com.android.support:support-compat:27.1.0
+--- com.android.support:support-annotations:27.1.0
\--- android.arch.lifecycle:runtime:1.1.0
+--- android.arch.lifecycle:common:1.1.0
\--- android.arch.core:common:1.1.0
debugWearApp - Link to a wear app to embed for object 'debug'. (n)
No dependencies
debugWearBundling - Resolved Configuration for wear app bundling for variant: debug
No dependencies
default - Configuration for default artifacts.
No dependencies
implementation - Implementation only dependencies for 'main' sources. (n)
\--- com.android.support:support-compat:27.1.0 (n)
lintChecks - Configuration to apply external lint check jar
No dependencies
provided - Provided dependencies for 'main' sources (deprecated: use 'compileOnly' instead). (n)
No dependencies
releaseAnnotationProcessor - Classpath for the annotation processor for 'release'. (n)
No dependencies
releaseAnnotationProcessorClasspath - Resolved configuration for annotation-processor for variant: release
No dependencies
releaseApi - API dependencies for 'release' sources. (n)
No dependencies
releaseApiElements - API elements for release (n)
No dependencies
releaseApk - Apk dependencies for 'release' sources (deprecated: use 'releaseRuntimeOnly' instead). (n)
No dependencies
releaseCompile - Compile dependencies for 'release' sources (deprecated: use 'releaseImplementation' instead). (n)
No dependencies
releaseCompileClasspath - Resolved configuration for compilation for variant: release
+--- project :libcocos2dx
+--- com.android.support:support-compat:27.1.0
| +--- com.android.support:support-annotations:27.1.0
| \--- android.arch.lifecycle:runtime:1.1.0
| +--- android.arch.lifecycle:common:1.1.0
| \--- android.arch.core:common:1.1.0
\--- com.android.support:multidex:1.0.2
releaseCompileOnly - Compile only dependencies for 'release' sources. (n)
No dependencies
releaseImplementation - Implementation only dependencies for 'release' sources. (n)
No dependencies
releaseMetadataElements - Metadata elements for release (n)
No dependencies
releaseProvided - Provided dependencies for 'release' sources (deprecated: use 'releaseCompileOnly' instead). (n)
No dependencies
releaseRuntimeClasspath - Resolved configuration for runtime for variant: release
+--- project :libcocos2dx
| \--- project :gps
+--- com.android.support:support-compat:27.1.0
| +--- com.android.support:support-annotations:27.1.0
| \--- android.arch.lifecycle:runtime:1.1.0
| +--- android.arch.lifecycle:common:1.1.0
| \--- android.arch.core:common:1.1.0
\--- com.android.support:multidex:1.0.2
releaseRuntimeElements - Runtime elements for release (n)
No dependencies
releaseRuntimeOnly - Runtime only dependencies for 'release' sources. (n)
No dependencies
releaseUnitTestAnnotationProcessorClasspath - Resolved configuration for annotation-processor for variant: releaseUnitTest
No dependencies
releaseUnitTestCompileClasspath - Resolved configuration for compilation for variant: releaseUnitTest
+--- project :libcocos2dx
\--- com.android.support:support-compat:27.1.0
+--- com.android.support:support-annotations:27.1.0
\--- android.arch.lifecycle:runtime:1.1.0
+--- android.arch.lifecycle:common:1.1.0
\--- android.arch.core:common:1.1.0
releaseUnitTestRuntimeClasspath - Resolved configuration for runtime for variant: releaseUnitTest
+--- project :libcocos2dx
| \--- project :gps
\--- com.android.support:support-compat:27.1.0
+--- com.android.support:support-annotations:27.1.0
\--- android.arch.lifecycle:runtime:1.1.0
+--- android.arch.lifecycle:common:1.1.0
\--- android.arch.core:common:1.1.0
releaseWearApp - Link to a wear app to embed for object 'release'. (n)
No dependencies
releaseWearBundling - Resolved Configuration for wear app bundling for variant: release
No dependencies
runtimeOnly - Runtime only dependencies for 'main' sources. (n)
No dependencies
testAnnotationProcessor - Classpath for the annotation processor for 'test'. (n)
No dependencies
testApi - API dependencies for 'test' sources. (n)
No dependencies
testApk - Apk dependencies for 'test' sources (deprecated: use 'testRuntimeOnly' instead). (n)
No dependencies
testCompile - Compile dependencies for 'test' sources (deprecated: use 'testImplementation' instead).
No dependencies
testCompileOnly - Compile only dependencies for 'test' sources. (n)
No dependencies
testDebugAnnotationProcessor - Classpath for the annotation processor for 'testDebug'. (n)
No dependencies
testDebugApi - API dependencies for 'testDebug' sources. (n)
No dependencies
testDebugApk - Apk dependencies for 'testDebug' sources (deprecated: use 'testDebugRuntimeOnly' instead). (n)
No dependencies
testDebugCompile - Compile dependencies for 'testDebug' sources (deprecated: use 'testDebugImplementation' instead). (n)
No dependencies
testDebugCompileOnly - Compile only dependencies for 'testDebug' sources. (n)
No dependencies
testDebugImplementation - Implementation only dependencies for 'testDebug' sources. (n)
No dependencies
testDebugProvided - Provided dependencies for 'testDebug' sources (deprecated: use 'testDebugCompileOnly' instead). (n)
No dependencies
testDebugRuntimeOnly - Runtime only dependencies for 'testDebug' sources. (n)
No dependencies
testDebugWearApp - Link to a wear app to embed for object 'testDebug'. (n)
No dependencies
testImplementation - Implementation only dependencies for 'test' sources. (n)
No dependencies
testProvided - Provided dependencies for 'test' sources (deprecated: use 'testCompileOnly' instead). (n)
No dependencies
testReleaseAnnotationProcessor - Classpath for the annotation processor for 'testRelease'. (n)
No dependencies
testReleaseApi - API dependencies for 'testRelease' sources. (n)
No dependencies
testReleaseApk - Apk dependencies for 'testRelease' sources (deprecated: use 'testReleaseRuntimeOnly' instead). (n)
No dependencies
testReleaseCompile - Compile dependencies for 'testRelease' sources (deprecated: use 'testReleaseImplementation' instead). (n)
No dependencies
testReleaseCompileOnly - Compile only dependencies for 'testRelease' sources. (n)
No dependencies
testReleaseImplementation - Implementation only dependencies for 'testRelease' sources. (n)
No dependencies
testReleaseProvided - Provided dependencies for 'testRelease' sources (deprecated: use 'testReleaseCompileOnly' instead). (n)
No dependencies
testReleaseRuntimeOnly - Runtime only dependencies for 'testRelease' sources. (n)
No dependencies
testReleaseWearApp - Link to a wear app to embed for object 'testRelease'. (n)
No dependencies
testRuntimeOnly - Runtime only dependencies for 'test' sources. (n)
No dependencies
testWearApp - Link to a wear app to embed for object 'test'. (n)
No dependencies
wearApp - Link to a wear app to embed for object 'main'. (n)
No dependencies
(*) - dependencies omitted (listed previously)
(n) - Not resolved (configuration is not meant to be resolved)
BUILD SUCCESSFUL in 1s
1 actionable task: 1 executed
What was the final solution for that?
Please check the updated description. I must thank you for you suggestions as well 
I guess many working on cocos2d-x might end up with same issue if they try to add local notifications in android.
I checked the current github and it hasn’t any support-lib there. So it was your own fault or an older cocos version with bad files.
Good to know that it doesnt exist anymore. The version that I use was there before I started working so it might be an older version.