我尝试在我的应用中使用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。 {*; } **到proguard文件但不解决问题。 控制台:
[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
答案 0 :(得分:8)
您需要添加-dontwarn com.googlecode.mp4parser.**