3

即使在启用 proguard 的情况下导出我的应用程序后,Admob 调试消息仍会显示在 LogCat 上

它看起来像这样

10-25 10:13:22.913: I/Ads(13399): adRequestUrlHtml: AFMA_buildAdURL({"preqs":12,"session_id":"6802423233789","u_sd":2,"seq_num":"13"," slotname":"我的私钥!!","u_w":384,"msid":"com.mypackage","js":"afma-sdk-a-v6.1.0","toar":0," mv":"80230011.com.android.vending","isu":"25C96A854AB7982C962ED93D02871DA89","cipa":1,"format":"320x50_mb","net":"ed","app_name":"41. android.com.my.package","hl":"en","u_h":592,"carrier":"23430","ptime":1112155,"u_audio":3});

如何禁用这些消息?

编辑:

这就是我的 proguard 配置的样子

-dontwarn com.androidquery.auth.*

-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*

#-keepparameternames
-renamesourcefileattribute SourceFile
-keepattributes Exceptions,InnerClasses,Signature,Deprecated,
                SourceFile,LineNumberTable,*Annotation*,EnclosingMethod

#-keep public class com.androidquery.*,com.androidquery.callback.*,com.androidquery.util.AQUtility,com.androidquery.util.Constants {
-keep public class *{
    public protected *;
}

-keepclassmembernames class * {
    java.lang.Class class$(java.lang.String);
    java.lang.Class class$(java.lang.String, boolean);
}

-keepclasseswithmembernames class * {
    native <methods>;
}

-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}

-keepclassmembers class * implements java.io.Serializable {
    static final long serialVersionUID;
    private static final java.io.ObjectStreamField[] serialPersistentFields;
    private void writeObject(java.io.ObjectOutputStream);
    private void readObject(java.io.ObjectInputStream);
    java.lang.Object writeReplace();
    java.lang.Object readResolve();
}
# Remove log messages
-assumenosideeffects class android.util.Log {
    public static *** d(...);
    public static *** v(...);
    public static *** i(...);
}
4

2 回答 2

1

检查以下答案,其中调试和详细日志在 proguard.cfg 文件中被禁用,使用:

-assumenosideeffects class android.util.Log {
    public static *** d(...);
    public static *** v(...);
}

您可以使用它来阻止 INFO 日志消息,方法是:

-assumenosideeffects class android.util.Log {
    public static *** d(...);
    public static *** v(...);
    public static *** i(...);
}

编辑:请注意,虽然不会记录消息,但字符串仍在生成的字节码中。有关更多信息,请参阅此答案

于 2013-10-25T09:29:17.030 回答
0

该消息是来自 Admob 库的 INFO 级消息。这不关你的事。

你有什么顾虑,那就是显示你的 AdUnitId?您是否担心其他人会使用它并为他们的流量而归功于您?

我不会担心的。

于 2013-10-25T22:34:45.400 回答