Question

I have a application that i want to build with progaurd i am using ksoap and itext jars in this applicaction now the problem is while building the app in release mode(signed apk) i am getting error(see the error log below) i earlier tried solving this error by using -dontwarn but after using this when i install the apk the app stops behaving like is used to i think few of the classes referenced from the jar files are not behaving properly or whatever may be the cause. Is there any effective solution to this? Any help will be greatly appreciated. Thanks !

[2012-11-10 23:52:17 - Nestle-SHSH] Proguard returned with error code 1. See console
[2012-11-10 23:52:17 - Nestle-SHSH] Note: there were 4 duplicate class definitions.
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find superclass or interface java.awt.Graphics2D
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D$FakeComponent: can't find superclass or interface java.awt.Component
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D$HyperLinkKey: can't find superclass or interface java.awt.RenderingHints$Key
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfPrinterGraphics2D: can't find superclass or interface java.awt.print.PrinterGraphics
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.geom.PolylineShape: can't find superclass or interface java.awt.Shape
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.geom.PolylineShapeIterator: can't find superclass or interface java.awt.geom.PathIterator
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: library class android.content.res.XmlResourceParser extends or implements program class org.xmlpull.v1.XmlPullParser
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.AsianFontMapper: can't find referenced class java.awt.Font
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.AsianFontMapper: can't find referenced class java.awt.Font
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.AsianFontMapper: can't find referenced class java.awt.Font
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.AsianFontMapper: can't find referenced class java.awt.Font
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.DefaultFontMapper: can't find referenced class java.awt.Font
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.DefaultFontMapper: can't find referenced class java.awt.Font
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.DefaultFontMapper: can't find referenced class java.awt.Font
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.DefaultFontMapper: can't find referenced class java.awt.Font
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.DefaultFontMapper: can't find referenced class java.awt.Font
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.DefaultFontMapper: can't find referenced class java.awt.Font
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.DefaultFontMapper: can't find referenced class java.awt.Font
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.DefaultFontMapper: can't find referenced class java.awt.Font
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.DefaultFontMapper: can't find referenced class java.awt.Font
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.FontMapper: can't find referenced class java.awt.Font
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.FontMapper: can't find referenced class java.awt.Font
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.image.BufferedImage
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.image.BufferedImage
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.image.BufferedImage
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.RenderingHints
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.RenderingHints
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.Graphics2D
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.Graphics2D
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.BasicStroke
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.BasicStroke
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.RenderingHints
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.RenderingHints
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.geom.AffineTransform
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.geom.AffineTransform
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.Color
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.Color
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.Font
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.Font
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.geom.Area
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.geom.Rectangle2D$Float
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.geom.Rectangle2D$Float
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.geom.Area
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.image.BufferedImage
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.image.BufferedImageOp
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.image.BufferedImageOp
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.image.RenderedImage
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.image.RenderedImage
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.image.RenderedImage
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.image.ColorModel
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.image.ColorModel
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.image.RenderedImage
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.image.RenderedImage
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.image.BufferedImage
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.image.RenderedImage
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.image.renderable.RenderableImage
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.Font
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.Font
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.Color
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.Font
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.Font
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.Font
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.geom.AffineTransform
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.Font
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.geom.AffineTransform
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.geom.AffineTransform
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.geom.AffineTransform
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.Font
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.Font
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.Font
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.Font
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.Font
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.Font
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.Color
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.Color
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.Font
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.Font
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.geom.Rectangle2D
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.Font
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.geom.Rectangle2D
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.geom.Line2D$Double
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.geom.Line2D$Double
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced method 'java.awt.FontMetrics getFontMetrics()' in class com.itextpdf.awt.PdfGraphics2D
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: com.itextpdf.awt.PdfGraphics2D: can't find referenced class java.awt.FontMetrics
[2012-11-10 23:52:17 - Nestle-SHSH]          You must avoid such dependencies, since the program classes will
[2012-11-10 23:52:17 - Nestle-SHSH]          be processed, while the library classes will remain unchanged.
[2012-11-10 23:52:17 - Nestle-SHSH] Warning: there were 1 unresolved references to program class members.
[2012-11-10 23:52:17 - Nestle-SHSH]          Your input classes appear to be inconsistent.
[2012-11-10 23:52:17 - Nestle-SHSH]          You may need to recompile them and try again.
[2012-11-10 23:52:17 - Nestle-SHSH]          Alternatively, you may have to specify the option 
[2012-11-10 23:52:17 - Nestle-SHSH]          '-dontskipnonpubliclibraryclassmembers'.
[2012-11-10 23:52:17 - Nestle-SHSH] java.io.IOException: Please correct the above warnings first.
[2012-11-10 23:52:17 - Nestle-SHSH]     at proguard.Initializer.execute(Initializer.java:321)
[2012-11-10 23:52:17 - Nestle-SHSH]     at proguard.ProGuard.initialize(ProGuard.java:211)
[2012-11-10 23:52:17 - Nestle-SHSH]     at proguard.ProGuard.execute(ProGuard.java:86)
[2012-11-10 23:52:17 - Nestle-SHSH]     at proguard.ProGuard.main(ProGuard.java:492)

Here is my proguard.cfg file :-

-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*

-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class com.android.vending.licensing.ILicensingService

-keepclasseswithmembernames class * {
    native <methods>;
}

-keepclasseswithmembers class * {
    public <init>(android.content.Context, android.util.AttributeSet);
}

-keepclasseswithmembers class * {
    public <init>(android.content.Context, android.util.AttributeSet, int);
}

-keepclassmembers class * extends android.app.Activity {
   public void *(android.view.View);
}

-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}

-keep class * implements android.os.Parcelable {
  public static final android.os.Parcelable$Creator *;
}
Was it helpful?

Solution

I made some adjustments in the code where the application was crashing but that i think this was solution in my case only cause i had the alternate way of doing it. Is was about getting the location using novocation library which i replaced with some other code stuff. But the main problem that i still don't have any answer is that why those libraries stop behaving like normal when application is built using proguard. I used source code of the jar files in my application and found that some of the classes are not compiled due to some anonymous code stuff and that was originally the reason why there were warnings while building with proguard. I simply removed the classes which were showing compile time errors(these were only a few and had no impact on the functioning of the code) this can be equated to -dontwarn in proguard.cfg file.So i think it still need some deep research. Thanks @pst for your valuable suggestions.

OTHER TIPS

you can just add

-dontwarn com.itextpdf.** 

to your proguard file or migrate to

com.itextpdf:itextg:**
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top