Kor*_*oly 20 java obfuscation android proguard flurry
这是我的proguard配置(我从android工具文件夹复制它并添加了一些行
-optimizations !code/simplification/arithmetic,!code/simplification/cast,!field/*,!class/merging/*
-optimizationpasses 5
-allowaccessmodification
-dontpreverify
# The remainder of this file is identical to the non-optimized version
# of the Proguard configuration file (except that the other file has
# flags to turn off optimization).
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-verbose
-keepattributes *Annotation*
-keep public class com.google.vending.licensing.ILicensingService
-keep public class com.android.vending.licensing.ILicensingService
# For native methods, see http://proguard.sourceforge.net/manual/examples.html#native
-keepclasseswithmembernames class * {
native <methods>;
}
# keep setters in Views so that animations can still work.
# see http://proguard.sourceforge.net/manual/examples.html#beans
-keepclassmembers public class * extends android.view.View {
void set*(***);
*** get*();
}
# We want to keep methods in Activity that could be used in the XML attribute onClick
-keepclassmembers class * extends android.app.Activity {
public void *(android.view.View);
}
# For enumeration classes, see http://proguard.sourceforge.net/manual/examples.html#enumerations
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}
-keepclassmembers class **.R$* {
public static <fields>;
}
# The support library contains references to newer platform versions.
# Don't warn about those in case this app is linking against an older
# platform version. We know about them, and they are safe.
-dontwarn android.support.**
######################
# added by me
########################
# guava
-keepclasseswithmembers class com.google.common.base.internal.Finalizer{
<methods>;
}
-dontwarn sun.misc.Unsafe
-dontwarn com.google.common.collect.MinMaxPriorityQueue
#
#Action Bar Sherlock
-keep class android.support.v4.app.** { *; }
-keep interface android.support.v4.app.** { *; }
-keep class com.actionbarsherlock.** { *; }
-keep interface com.actionbarsherlock.** { *; }
#-dontobfuscate
#-libraryjars libs/FlurryAgent.jar
Run Code Online (Sandbox Code Playgroud)
我想在我的应用程序使用乱舞,但是当我试图混淆我的应用程序FlurryAgen.jar ProGuard的失败,说像这样的错误的dosens:
Warning: com.flurry.android.ay: can't find referenced class com.google.ads.AdListener
Run Code Online (Sandbox Code Playgroud)
当我试图不混淆源时,proguard也失败了.
如何使用proguard乱舞?以及如何使proguard不混淆我的来源?
更新 我还提到FlurryAgent.jar似乎已经混淆了 - http://korniltsev.ru/p/jBU0f1c.png.可能我们可以忽略整个罐子的缩小?
Kor*_*oly 46
最后我设法这样做:
-keep class com.flurry.** { *; }
-dontwarn com.flurry.**
Run Code Online (Sandbox Code Playgroud)
Dan*_*ler 10
Korniltsev的答案对我有用,但新的flurry SDK(3.2.2)建议添加以下内容:
-keep class com.flurry.** { *; }
-dontwarn com.flurry.**
-keepattributes *Annotation*,EnclosingMethod
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet, int);
}
Run Code Online (Sandbox Code Playgroud)
可能存在需要新行的一些极端情况,因此我最终使用自述文件.
我不确定Flurry是如何与AdListener进行特定交互的,但Google的类名称正在被混淆.
尝试将该行添加-keep public class com.google.ads.AdListener
到proguard文件中.如果Flurry使用其他com.google.ads类,您可能需要添加更多类异常,但该行应解决您的即时警告.
更新: 问题是公共类方法名称正在为各种广告库进行模糊处理.因此,您可能需要包含其他proguard设置以包含以下方法:
-keep public class com.google.ads.** { public protected *; }
-keep public class com.inmobi.androidsdk.** { public protected *; }
-keep public class com.millenialmedia.android.** { public protected *; }
-keep public class com.mobclix.android.sdk.** { public protected *; }
-keep public class com.jumptap.adtag.** { public protected *; }
Run Code Online (Sandbox Code Playgroud)
与Flurry一起工作并自己编程,确保在上传到您选择的应用市场之前彻底测试apk.