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

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

Tagged:

Answers

  • rseostarrseostar USUniversity ✭✭

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

  • YkshLeoYkshLeo USMember ✭✭✭✭

    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.

  • samnz19samnz19 USMember

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

  • YkshLeoYkshLeo USMember ✭✭✭✭

    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/proguard_xamarin.cfg. Keep in mind that your configuration file (if you provide one) does not replace the proguard_xamarin.cfg file since both are used by ProGuard.

    Refer :

  • samnz19samnz19 USMember
    edited November 2015

    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.MonoPackageManager_Resources
    -keep class mono.android.**
    -keep class mono.java.**
    -keep class mono.javax.**
    -keep class opentk.platform.android.AndroidGameView
    -keep class opentk.GameViewBase
    -keep class opentk_1_0.platform.android.AndroidGameView
    -keep class opentk_1_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);
    }

  • samnz19samnz19 USMember

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

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

  • samnz19samnz19 USMember

    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?

  • YkshLeoYkshLeo USMember ✭✭✭✭

    @samnz19,

    For removing Proguard settings.

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

  • samnz19samnz19 USMember

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

  • SteveShaw.5557SteveShaw.5557 USMember ✭✭

    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

  • BuildCalcBuildCalc USMember ✭✭✭

    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?

  • i_NateCooki_NateCook USMember ✭✭

    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

  • rafaelbparafaelbpa BRMember ✭✭

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

  • batmacibatmaci DEMember ✭✭✭✭

    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

  • SamihELSAKHAWISamihELSAKHAWI USMember ✭✭

    Any Update about this?

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

  • ValonSejdiniValonSejdini USMember
    edited November 5

    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])

  • ValonSejdiniValonSejdini USMember

    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])
    ....

Sign In or Register to comment.