【问题标题】:Error when exporting app that used Proguard导出使用 Proguard 的应用时出错
【发布时间】:2015-10-16 14:09:20
【问题描述】:

我尝试在我的应用中使用 Proguard。我在 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   Mp4ParserWrapper.** { *; }
-keep public class com.android.vending.licensing.ILicensingService
-keepclasseswithmembernames class * {
    native <methods>;
}
-keepclasseswithmembernames class * {
    public <init>(android.content.Context, android.util.AttributeSet);
}
-keepclasseswithmembernames class * {
    public <init>(android.content.Context, android.util.AttributeSet, int);
}
-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}
-keep class * implements android.os.Parcelable {
  public static final android.os.Parcelable$Creator *;
}

当导出应用程序得到找不到引用的类错误。我在互联网上搜索并添加这一行-keep public class Mp4ParserWrapper. { *; }** 保护文件但不解决问题。 控制台:

[2015-10-16 17:29:09 - nabege] Proguard returned with error code 1. See console
[2015-10-16 17:29:09 - nabege] Warning: com.googlecode.mp4parser.authoring.tracks.mjpeg.OneJpegPerIframe: can't find referenced class javax.imageio.ImageIO
[2015-10-16 17:29:09 - nabege] Warning: com.googlecode.mp4parser.authoring.tracks.mjpeg.OneJpegPerIframe: can't find referenced class javax.imageio.ImageIO
[2015-10-16 17:29:09 - nabege] Warning: com.googlecode.mp4parser.authoring.tracks.mjpeg.OneJpegPerIframe: can't find referenced class java.awt.image.BufferedImage
[2015-10-16 17:29:09 - nabege] Warning: com.googlecode.mp4parser.authoring.tracks.mjpeg.OneJpegPerIframe: can't find referenced class java.awt.image.BufferedImage
[2015-10-16 17:29:09 - nabege] Warning: com.googlecode.mp4parser.authoring.tracks.mjpeg.OneJpegPerIframe: can't find referenced class java.awt.image.BufferedImage
[2015-10-16 17:29:09 - nabege] Warning: com.googlecode.mp4parser.authoring.tracks.mjpeg.OneJpegPerIframe: can't find referenced class java.awt.image.BufferedImage
[2015-10-16 17:29:09 - nabege]       You should check if you need to specify additional program jars.
[2015-10-16 17:29:09 - nabege] Warning: there were 6 unresolved references to classes or interfaces.
[2015-10-16 17:29:09 - nabege]          You may need to specify additional library jars (using '-libraryjars').
[2015-10-16 17:29:09 - nabege] java.io.IOException: Please correct the above warnings first.
[2015-10-16 17:29:09 - nabege]  at proguard.Initializer.execute(Initializer.java:321)
[2015-10-16 17:29:09 - nabege]  at proguard.ProGuard.initialize(ProGuard.java:211)
[2015-10-16 17:29:09 - nabege]  at proguard.ProGuard.execute(ProGuard.java:86)
[2015-10-16 17:29:09 - nabege]  at proguard.ProGuard.main(ProGuard.java:492)
[2015-10-16 17:29:09 - nabege] Picked up _JAVA_OPTIONS: -Xms256m -Xmx512m

【问题讨论】:

    标签: android proguard


    【解决方案1】:

    您需要添加-dontwarn com.googlecode.mp4parser.**

    【讨论】:

    • 我要补充一点,您可能不需要在您的 Proguard 配置中使用“keep public class Mp4ParserWrapper”行,并在上面实现了 aiwiguna 的答案。
    • 你删除了 -keep public class Mp4ParserWrapper。 { *; } 就像 Bradford2000 所说的那样?
    • 好的。我将此行添加到 proguard 文件中并解决了:-dontwarn com.googlecode.mp4parser.authoring.tracks.mjpeg.OneJpegPerIframe
    • 对不起,我忘了它需要两个 asterix :( -dontwarn com.googlecode.mp4parser.**
    • 抱歉,我遇到了完全相同的问题,但您的建议不起作用... :(
    猜你喜欢
    • 2016-01-14
    • 1970-01-01
    • 2023-03-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-07-09
    • 2014-08-22
    • 1970-01-01
    相关资源
    最近更新 更多