Proguard 错误日志给出错误的 library/class 名称
Proguard error log giving wrong library/class name
我一直在尝试使用 Proguard
生成 APK,但每次我都会收到此错误。它警告我一些我找不到的内部 class 并且名称似乎被混淆了,如下所示:
class Error:(b.a.a.a.a.b.o)
这是我的混淆文件:
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontskipnonpubliclibraryclassmembers
-verbose
-dontpreverify
#-dontshrink
#-dontoptimize
-keepattributes *Annotation*, Exceptions, Signature, Deprecated, SourceFile, SourceDir, LineNumberTable, LocalVariableTable, LocalVariableTypeTable, Synthetic, EnclosingMethod, RuntimeVisibleAnnotations, RuntimeInvisibleAnnotations, RuntimeVisibleParameterAnnotations, RuntimeInvisibleParameterAnnotations, AnnotationDefault, InnerClasses
-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
-keep class android.content.Context {
public java.io.File getExternalCacheDir();
}
-keep public class * extends android.view.View {
public <init>(android.content.Context);
public <init>(android.content.Context, android.util.AttributeSet);
public <init>(android.content.Context, android.util.AttributeSet, int);
public void set*(...);
}
-dontwarn java.awt.**
-keep class java.awt.** { *; }
-dontwarn android.support.v4.**
-keep class android.support.v4.** { *; }
-dontwarn com.viewpagerindicator.**
# Allow obfuscation of android.support.v7.internal.view.menu.**
# to avoid problem on Samsung 4.2.2 devices with appcompat v21
# see https://code.google.com/p/android/issues/detail?id=78377
# see
-keep class !android.support.v7.internal.view.menu.*MenuBuilder*, android.support.v7.** { *; }
-keep interface android.support.v7.** { *; }
##################
#.___ My project name __.#
##################
-keep public class com.myprojectname.** { public *; }
-dontwarn com.myprojectname.**
##################
#.___ Amplitude __.#
##################
-dontwarn okio.**
-keep class okio.** { *; }
#-dontwarn android.util.FloatMath
-keep class android.util.FloatMath { *; }
##################
#.___ Glide __.#
##################
-keep public class * implements com.bumptech.glide.module.GlideModule
-keep public enum com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$** {
**[] $VALUES;
public *;
}
##################
#.___ JavaCV __.#
##################
-dontwarn org.bytedeco.javacv.**
-keep class org.bytedeco.javacv.** { *; }
-dontwarn org.bytedeco.javacpp.**
-keep class org.bytedeco.javacpp.** { *; }
-keep @org.bytedeco.javacpp.annotation interface * { *; }
-keep @org.bytedeco.javacpp.annotation.Platform public class *
-keep @interface org.bytedeco.javacpp.annotation.*,javax.inject.*
-keepclasseswithmembernames class * {
@org.bytedeco.* <fields>;
}
-keepclasseswithmembernames class * {
@org.bytedeco.* <methods>;
}
##################
#.___ Facebook __.#
##################
-keep class com.facebook.** { *; }
##################
#.___ Twitter __.#
##################
-keepclassmembers class com.mopub.** { public *; }
-keep public class com.mopub.**
-keep public class android.webkit.JavascriptInterface {}
-keep class * extends com.mopub.mobileads.CustomEventBanner {}
-keep class * extends com.mopub.mobileads.CustomEventInterstitial {}
-keep class * extends com.mopub.mobileads.CustomEventNative {}
-keep class com.google.android.gms.common.GooglePlayServicesUtil {*;}
-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient {*;}
-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient$Info {*;}
-keep class * extends java.util.ListResourceBundle {
protected Object[][] getContents();
}
-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
public static final *** NULL;
}
-keepnames @com.google.android.gms.common.annotation.KeepName class *
-keepclassmembernames class * {
@com.google.android.gms.common.annotation.KeepName *;
}
-keepnames class * implements android.os.Parcelable {
public static final ** CREATOR;
}
-dontwarn twitter4j.**
-keep class twitter4j.** { *; }
##################
#.___ MP4Parser __.#
##################
-keep class * implements com.coremedia.iso.boxes.Box { *; }
-dontwarn com.coremedia.iso.boxes.**
-keep class com.coremedia.iso.boxes.** { *; }
-dontwarn com.googlecode.mp4parser.authoring.tracks.mjpeg.**
-keep class com.googlecode.mp4parser.authoring.tracks.mjpeg.** { *; }
-dontwarn com.googlecode.mp4parser.authoring.tracks.ttml.**
-keep class com.googlecode.mp4parser.authoring.tracks.ttml.** { *; }
##################
#.___ Crashlitics __.#
##################
-keep class com.crashlytics.** { *; }
-dontwarn com.crashlytics.**
这是我得到的完整错误日志:
Error:warning: Ignoring InnerClasses attribute for an anonymous inner
class Error:(b.a.a.a.a.b.o) that doesn't come with an Error:associated
EnclosingMethod attribute. This class was probably produced by a
Error:compiler that did not target the modern .class file format. The
recommended Error:solution is to recompile the class from source,
using an up-to-date compiler Error:and without specifying any
"-target" type options. The consequence of ignoring Error:this warning
is that reflective operations on this class will incorrectly
Error:indicate that it is not an inner class. Error:warning:
Ignoring InnerClasses attribute for an anonymous inner class
Error:(b.a.a.a.a.b.n) that doesn't come with an Error:associated
EnclosingMethod attribute. This class was probably produced by a
Error:compiler that did not target the modern .class file format. The
recommended Error:solution is to recompile the class from source,
using an up-to-date compiler Error:and without specifying any
"-target" type options. The consequence of ignoring Error:this warning
is that reflective operations on this class will incorrectly
Error:indicate that it is not an inner class. Error:Uncaught
translation error: com.android.dx.cf.code.SimException: local variable
type mismatch: attempt to set or access a value of type int using a
local variable of type
android.support.design.widget.CoordinatorLayout$e. This is symptomatic
of .class transformation tools that ignore local variable information.
Error:Uncaught translation error: com.android.dx.cf.code.SimException:
local variable type mismatch: attempt to set or access a value of type
float using a local variable of type int. This is symptomatic of
.class transformation tools that ignore local variable information.
Error:Uncaught translation error: com.android.dx.cf.code.SimException:
local variable type mismatch: attempt to set or access a value of type
float using a local variable of type android.view.MotionEvent. This is
symptomatic of .class transformation tools that ignore local variable
information. Error:Uncaught translation error:
com.android.dx.cf.code.SimException: local variable type mismatch:
attempt to set or access a value of type java.lang.Object using a
local variable of type long. This is symptomatic of .class
transformation tools that ignore local variable information.
Error:Uncaught translation error: com.android.dx.cf.code.SimException:
local variable type mismatch: attempt to set or access a value of type
java.lang.Object using a local variable of type int. This is
symptomatic of .class transformation tools that ignore local variable
information. Error:Uncaught translation error:
com.android.dx.cf.code.SimException: local variable type mismatch:
attempt to set or access a value of type java.lang.Object using a
local variable of type char. This is symptomatic of .class
transformation tools that ignore local variable information.
Error:Uncaught translation error: com.android.dx.cf.code.SimException:
local variable type mismatch: attempt to set or access a value of type
java.lang.Object using a local variable of type int. This is
symptomatic of .class transformation tools that ignore local variable
information. Error:Uncaught translation error:
com.android.dx.cf.code.SimException: local variable type mismatch:
attempt to set or access a value of type java.lang.Object using a
local variable of type int. This is symptomatic of .class
transformation tools that ignore local variable information.
Error:Uncaught translation error: com.android.dx.cf.code.SimException:
local variable type mismatch: attempt to set or access a value of type
int using a local variable of type
android.support.v4.hardware.display.DisplayManagerCompat. This is
symptomatic of .class transformation tools that ignore local variable
information. Error:Error converting bytecode to dex: Cause:
java.lang.RuntimeException: Translation has been interrupted
Error:Execution failed for task
':myprojectname:transformClassesWithDexForRelease'.
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException:
java.util.concurrent.ExecutionException:
com.android.ide.common.process.ProcessException:
org.gradle.process.internal.ExecException: Process 'command
'/usr/lib/jvm/java-7-openjdk-amd64/bin/java'' finished with non-zero
exit value 2 Information:BUILD FAILED
任何提示将不胜感激^ ^
我设法通过将构建变体从发布更改为调试来获得正确的库名称。
我一直在尝试使用 Proguard
生成 APK,但每次我都会收到此错误。它警告我一些我找不到的内部 class 并且名称似乎被混淆了,如下所示:
class Error:(b.a.a.a.a.b.o)
这是我的混淆文件:
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontskipnonpubliclibraryclassmembers
-verbose
-dontpreverify
#-dontshrink
#-dontoptimize
-keepattributes *Annotation*, Exceptions, Signature, Deprecated, SourceFile, SourceDir, LineNumberTable, LocalVariableTable, LocalVariableTypeTable, Synthetic, EnclosingMethod, RuntimeVisibleAnnotations, RuntimeInvisibleAnnotations, RuntimeVisibleParameterAnnotations, RuntimeInvisibleParameterAnnotations, AnnotationDefault, InnerClasses
-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
-keep class android.content.Context {
public java.io.File getExternalCacheDir();
}
-keep public class * extends android.view.View {
public <init>(android.content.Context);
public <init>(android.content.Context, android.util.AttributeSet);
public <init>(android.content.Context, android.util.AttributeSet, int);
public void set*(...);
}
-dontwarn java.awt.**
-keep class java.awt.** { *; }
-dontwarn android.support.v4.**
-keep class android.support.v4.** { *; }
-dontwarn com.viewpagerindicator.**
# Allow obfuscation of android.support.v7.internal.view.menu.**
# to avoid problem on Samsung 4.2.2 devices with appcompat v21
# see https://code.google.com/p/android/issues/detail?id=78377
# see
-keep class !android.support.v7.internal.view.menu.*MenuBuilder*, android.support.v7.** { *; }
-keep interface android.support.v7.** { *; }
##################
#.___ My project name __.#
##################
-keep public class com.myprojectname.** { public *; }
-dontwarn com.myprojectname.**
##################
#.___ Amplitude __.#
##################
-dontwarn okio.**
-keep class okio.** { *; }
#-dontwarn android.util.FloatMath
-keep class android.util.FloatMath { *; }
##################
#.___ Glide __.#
##################
-keep public class * implements com.bumptech.glide.module.GlideModule
-keep public enum com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$** {
**[] $VALUES;
public *;
}
##################
#.___ JavaCV __.#
##################
-dontwarn org.bytedeco.javacv.**
-keep class org.bytedeco.javacv.** { *; }
-dontwarn org.bytedeco.javacpp.**
-keep class org.bytedeco.javacpp.** { *; }
-keep @org.bytedeco.javacpp.annotation interface * { *; }
-keep @org.bytedeco.javacpp.annotation.Platform public class *
-keep @interface org.bytedeco.javacpp.annotation.*,javax.inject.*
-keepclasseswithmembernames class * {
@org.bytedeco.* <fields>;
}
-keepclasseswithmembernames class * {
@org.bytedeco.* <methods>;
}
##################
#.___ Facebook __.#
##################
-keep class com.facebook.** { *; }
##################
#.___ Twitter __.#
##################
-keepclassmembers class com.mopub.** { public *; }
-keep public class com.mopub.**
-keep public class android.webkit.JavascriptInterface {}
-keep class * extends com.mopub.mobileads.CustomEventBanner {}
-keep class * extends com.mopub.mobileads.CustomEventInterstitial {}
-keep class * extends com.mopub.mobileads.CustomEventNative {}
-keep class com.google.android.gms.common.GooglePlayServicesUtil {*;}
-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient {*;}
-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient$Info {*;}
-keep class * extends java.util.ListResourceBundle {
protected Object[][] getContents();
}
-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
public static final *** NULL;
}
-keepnames @com.google.android.gms.common.annotation.KeepName class *
-keepclassmembernames class * {
@com.google.android.gms.common.annotation.KeepName *;
}
-keepnames class * implements android.os.Parcelable {
public static final ** CREATOR;
}
-dontwarn twitter4j.**
-keep class twitter4j.** { *; }
##################
#.___ MP4Parser __.#
##################
-keep class * implements com.coremedia.iso.boxes.Box { *; }
-dontwarn com.coremedia.iso.boxes.**
-keep class com.coremedia.iso.boxes.** { *; }
-dontwarn com.googlecode.mp4parser.authoring.tracks.mjpeg.**
-keep class com.googlecode.mp4parser.authoring.tracks.mjpeg.** { *; }
-dontwarn com.googlecode.mp4parser.authoring.tracks.ttml.**
-keep class com.googlecode.mp4parser.authoring.tracks.ttml.** { *; }
##################
#.___ Crashlitics __.#
##################
-keep class com.crashlytics.** { *; }
-dontwarn com.crashlytics.**
这是我得到的完整错误日志:
Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(b.a.a.a.a.b.o) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is not an inner class. Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(b.a.a.a.a.b.n) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is not an inner class. Error:Uncaught translation error: com.android.dx.cf.code.SimException: local variable type mismatch: attempt to set or access a value of type int using a local variable of type android.support.design.widget.CoordinatorLayout$e. This is symptomatic of .class transformation tools that ignore local variable information. Error:Uncaught translation error: com.android.dx.cf.code.SimException: local variable type mismatch: attempt to set or access a value of type float using a local variable of type int. This is symptomatic of .class transformation tools that ignore local variable information. Error:Uncaught translation error: com.android.dx.cf.code.SimException: local variable type mismatch: attempt to set or access a value of type float using a local variable of type android.view.MotionEvent. This is symptomatic of .class transformation tools that ignore local variable information. Error:Uncaught translation error: com.android.dx.cf.code.SimException: local variable type mismatch: attempt to set or access a value of type java.lang.Object using a local variable of type long. This is symptomatic of .class transformation tools that ignore local variable information. Error:Uncaught translation error: com.android.dx.cf.code.SimException: local variable type mismatch: attempt to set or access a value of type java.lang.Object using a local variable of type int. This is symptomatic of .class transformation tools that ignore local variable information. Error:Uncaught translation error: com.android.dx.cf.code.SimException: local variable type mismatch: attempt to set or access a value of type java.lang.Object using a local variable of type char. This is symptomatic of .class transformation tools that ignore local variable information. Error:Uncaught translation error: com.android.dx.cf.code.SimException: local variable type mismatch: attempt to set or access a value of type java.lang.Object using a local variable of type int. This is symptomatic of .class transformation tools that ignore local variable information. Error:Uncaught translation error: com.android.dx.cf.code.SimException: local variable type mismatch: attempt to set or access a value of type java.lang.Object using a local variable of type int. This is symptomatic of .class transformation tools that ignore local variable information. Error:Uncaught translation error: com.android.dx.cf.code.SimException: local variable type mismatch: attempt to set or access a value of type int using a local variable of type android.support.v4.hardware.display.DisplayManagerCompat. This is symptomatic of .class transformation tools that ignore local variable information. Error:Error converting bytecode to dex: Cause: java.lang.RuntimeException: Translation has been interrupted Error:Execution failed for task ':myprojectname:transformClassesWithDexForRelease'.
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/lib/jvm/java-7-openjdk-amd64/bin/java'' finished with non-zero exit value 2 Information:BUILD FAILED
任何提示将不胜感激^ ^
我设法通过将构建变体从发布更改为调试来获得正确的库名称。