locked
In a Xamarin.android project, How can I remove warnings: duplicate zip entry [classes.jar…] RRS feed

  • Question

  • User172435 posted

    I am getting errors:

             Warning can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [classes.jar:META-INF/MANIFEST.MF])   ColorPoint.Xamarin.XAndroid C:\Projects\cpxm\Product\Production\ColorPoint.Xamarin.Android\PROGUARD 
    
             Warning can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [internal_impl-22.2.1.jar:META-INF/MANIFEST.MF])  ColorPoint.Xamarin.XAndroid C:\Projects\cpxm\Product\Production\ColorPoint.Xamarin.Android\PROGUARD
    

    I deleted the 'classes.jar' and 'internal_impl-22.2.1.jar' files completely but still same warnings. When I try to edit the files - like some answers have said, the file is encoded and impossible to find duplicates in notepad ++

    project still builds fine, just the two warnings, and seems like proguard is not shrinking my app size by much.

    also there is no folder at : C:\Projects\cpxm\Product\Production\ColorPoint.Xamarin.Android\PROGUARD..... this is where duplicate is supposed to be

    there is proguard .cfg files at: C:\Projects\cpxm\Product\Production\ColorPoint.Xamarin.Android\obj\release\PROGU??ARD but cant edit them as they encoded

    I am not using build.gradle and not sure what it is. A lot of answers say to add code to packaging options in build.gradle.. Not sure how that would be done

    Wednesday, November 11, 2015 1:55 PM

All replies

  • User162820 posted

    I'm not sure if this helps, but I got the duplicate entry warnings when I had multi-dex on.

    Sunday, November 15, 2015 10:39 PM
  • User66025 posted

    Possibly a 'proguard.cfg' problem. Does it include any '-injars'? If your project includes another project as a library, jars can be processed twice. Could you post your 'proguard.cfg'?

    Extract from http://proguard.sourceforge.net/index.html#manual/troubleshooting.html

    Your input jars contain multiple resource files with the same name. ProGuard continues copying the resource files as usual, skipping any files with previously used names. Once more, the warning may be an indication of some problem though, so it's advisable to remove the duplicates. A convenient way to do so is by specifying filters on the input jars. There is no option to switch off these warnings.

    Monday, November 16, 2015 10:47 AM
  • User172435 posted

    Ok, so what is proguard.cfg? and where can I find it??

    Monday, November 16, 2015 11:22 AM
  • User66025 posted

    The ProGuard page at SourceForge explains the options that can be specified in a ProGuard configuration file. When Enable ProGuard is checked, Xamarin.Android also generates and uses a ProGuard configuration file at build time – this file is generated at obj/Release/proguard/proguardxamarin.cfg. Keep in mind that your configuration file (if you provide one) does not replace the proguardxamarin.cfg file since both are used by ProGuard.

    Refer :

    Monday, November 16, 2015 12:41 PM
  • User172435 posted

    Here is my proguard_xamarin.cfg file:

    This is Xamarin-specific (and enhanced) configuration.

    -dontobfuscate

    -keep class mono.MonoRuntimeProvider -keep class mono.MonoPackageManager -keep class mono.MonoPackageManagerResources -keep class mono.android.** -keep class mono.java.** -keep class mono.javax.** -keep class opentk.platform.android.AndroidGameView -keep class opentk.GameViewBase -keep class opentk10.platform.android.AndroidGameView -keep class opentk1_0.GameViewBase

    hash for android.runtime -keep class md52ce486a14f4bcd95899665e9d932190b.* -keepclassmembers class md52ce486a14f4bcd95899665e9d932190b.* { (*); }

    Android's template misses fluent setters... -keepclassmembers class * extends android.view.View { * set(); }

    also misses those inflated custom layout stuff from xml... -keepclassmembers class * extends android.view.View { (android.content.Context,android.util.AttributeSet); (android.content.Context,android.util.AttributeSet,int); }

    Monday, November 16, 2015 1:53 PM
  • User172435 posted

    coould i add this code to .cfg file? whould that help??...

    android.packagingOptions { pickFirst 'META-INF/MANIFEST.MF' }

    Monday, November 16, 2015 2:08 PM
  • User172435 posted

    I did previously run with multi-dex on, and have tried playing around with various different settings. Is there any way to disable and remove all proguard settings and config files and re start from scratch with proguard?

    Monday, November 16, 2015 4:03 PM
  • User66025 posted

    @samnz19,

    Refer : - http://stackoverflow.com/a/16586715/3891036 - http://www.dancartoon.com/2012/01/14/fixing-proguard-warning-cant-write-resource-meta-infmanifest-mf/

    Tuesday, November 17, 2015 4:53 AM
  • User66025 posted

    @samnz19,

    For removing Proguard settings.

    Try to delete the proguard directory in your project. So proguard will forget its mapping.

    Tuesday, November 17, 2015 4:56 AM
  • User172435 posted

    I've seen some of those questions before but they keep keep referring me to files that don't exist like 'build.xml' 'customrules.xml', build.gradle, 'proguardrules.txt'

    Tuesday, November 17, 2015 9:01 AM
  • User124403 posted

    FWIW: 1. Xamarin does not use gradle, so solutions involving 'build.gradle' won't apply, AFAIK. 2. Xamarin's proguard is found under the Android SDK path (in Tools/Options). For example, (userName)\AppData\Local\Xamarin\Universal\AndroidSDK\tools\proguard\proguard-android.txt is the default config. 3. To customize proguard for your project, add a config as described in Korayem's answer

    Saturday, February 11, 2017 10:52 PM
  • User253093 posted

    This is still going on years later. This and other forum comments don't clearly indicate what to do to fix or silence the warnings. Can someone from the Xam team comment on how to get these warnings addressed in a Xam Forms app?

    2>PROGUARD : warning : can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [formsviewgroup.jar:META-INF/MANIFEST.MF])
    2>PROGUARD : warning : can't write resource [.readme] (Duplicate zip entry [classes.jar:.readme])
    2>PROGUARD : warning : can't write resource [.readme] (Duplicate zip entry [classes.jar:.readme])
    
    Sunday, February 26, 2017 6:36 PM
  • User2122 posted

    I am not using Proguard and am still getting this warning:

    CREATEMULTIDEXMAINDEXCLASSLIST : warning : can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [android-support-multidex.jar:META-INF/MANIFEST.MF]) CREATEMULTIDEXMAINDEXCLASSLIST : warning : can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [classes.jar:META-INF/MANIFEST.MF]) CREATEMULTIDEXMAINDEXCLASSLIST : warning : can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [bolts-tasks.jar:META-INF/MANIFEST.MF]) CREATEMULTIDEXMAINDEXCLASSLIST : warning : can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [formsviewgroup.jar:META-INF/MANIFEST.MF]) CREATEMULTIDEXMAINDEXCLASSLIST : warning : can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [classes.jar:META-INF/MANIFEST.MF]) CREATEMULTIDEXMAINDEXCLASSLIST : warning : can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [classes.jar:META-INF/MANIFEST.MF]) CREATEMULTIDEXMAINDEXCLASSLIST : warning : can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [classes.jar:META-INF/MANIFEST.MF]) CREATEMULTIDEXMAINDEXCLASSLIST : warning : can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [classes.jar:META-INF/MANIFEST.MF]) CREATEMULTIDEXMAINDEXCLASSLIST : warning : can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [classes.jar:META-INF/MANIFEST.MF]) CREATEMULTIDEXMAINDEXCLASSLIST : warning : can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [classes.jar:META-INF/MANIFEST.MF]) CREATEMULTIDEXMAINDEXCLASSLIST : warning : can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [classes.jar:META-INF/MANIFEST.MF]) 11 Warning(s) 0 Error(s)

    My project requires MultiDex because of the number of references. Does anyone have any insights or good suggestions on where to start looking?

    Friday, May 19, 2017 3:30 PM
  • User77747 posted

    Please create a bugzilla when you run across this sort of thing. Also please ensure the bugzilla is public so all of us can see the bug and track its progress. Dev team members don't often read forum threads, but they do read bug reports.

    https://bugzilla.xamarin.com/show_bug.cgi?id=56834

    Thursday, May 25, 2017 11:59 AM
  • User304647 posted

    Did anyone fix this? Or a workaround maybe..?

    Thursday, August 24, 2017 2:51 AM
  • User176749 posted

    i am confused now. I have been using proguard.cfg in my project. Am I supposed to rename it to be proguard_xamarin.cfg? is there any disadvantage of using name proguard.cfg

    Wednesday, August 30, 2017 9:19 AM
  • User321273 posted

    Any Update about this?

    I'm having the same issues, and it's been weeks about finding a solution.

    Saturday, October 28, 2017 8:31 PM
  • User353307 posted

    Any update?

    I'm having similar issue.

    /Users/...MyProject/CREATEMULTIDEXMAINDEXCLASSLIST: Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [classes.jar:META-INF/MANIFEST.MF])

    Sunday, November 5, 2017 2:59 PM
  • User353307 posted

    I am not using Proguard. After enabling MultiDex I am getting this warning repeated 9 times:

    CREATEMULTIDEXMAINDEXCLASSLIST: Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [classes.jar:META-INF/MANIFEST.MF]) ....

    Tuesday, November 14, 2017 5:34 AM
  • User650 posted

    Any update on this? I'm NOT using Proguard and getting these warnings.

    Tuesday, December 12, 2017 5:50 PM
  • User181868 posted

    @AlexeyShikov said: Any update on this? I'm NOT using Proguard and getting these warnings.

    Me too. Pls help.

    Friday, December 15, 2017 10:39 PM
  • User75709 posted

    @JonDouglas : Can you or anyone from Xamarin can help us on this?

    Wednesday, March 11, 2020 4:00 AM
  • User352002 posted

    I have been using Proguard fine for a few releases of my app but I'm now getting these warnings in my Xamarin.Android project when I do a Release build as of today:

    PROGUARD : warning : can't write resource [META-INF/MSFTSIG.SF] (Duplicate zip entry [javaruntime.jar:META-INF/MSFTSIG.SF]) PROGUARD : warning : can't write resource [META-INF/MSFTSIG.RSA] (Duplicate zip entry [javaruntime.jar:META-INF/MSFTSIG.RSA])

    A couple of days ago I updated my Xamarin.Android project to use the PackageReference format for NuGet packages, not sure if that has anything to do with it.

    Is there any news on these warnings?

    Saturday, May 2, 2020 9:53 AM