1

我有一个我想用 progaurd 构建的应用程序我在这个应用程序中使用 ksoap 和 itext jar 现在问题是在以发布模式(签名 apk)构建应用程序时我收到错误(请参阅下面的错误日志)我之前尝试过通过使用 -dontwarn 解决此错误,但在我安装 apk 时使用此错误后,应用程序停止运行,我认为从 jar 文件中引用的类中很少有行为不正常或任何可能的原因。有什么有效的解决办法吗?任何帮助将不胜感激。谢谢 !

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

这是我的 proguard.cfg 文件:-

-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 *;
}
4

2 回答 2

0

我对应用程序崩溃的代码进行了一些调整,但我认为这是我的解决方案,只是因为我有另一种方法。是关于使用我用其他代码替换的 novocation 库获取位置。但是我仍然没有任何答案的主要问题是,当使用 proguard 构建应用程序时,为什么这些库会停止正常运行。我在我的应用程序中使用了 jar 文件的源代码,发现由于一些匿名代码的原因,一些类没有被编译,这最初是使用 proguard 构建时出现警告的原因。我只是删除了显示编译时错误的类(这些只是少数并且对代码的功能没有影响)这可以等同于 proguard.cfg 文件中的 -dontwarn。所以我认为它仍然需要一些深入的研究。感谢@pst 的宝贵建议。

于 2012-11-16T04:37:58.930 回答
0

你可以添加

-dontwarn com.itextpdf.** 

到您的 proguard 文件或迁移到

com.itextpdf:itextg:**
于 2018-12-10T04:06:56.167 回答