Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable admob debug messages

Even after exporting my app with proguard enabled, Admob debug messages are still showing up on LogCat

It looks something like this

10-25 10:13:22.913: I/Ads(13399): adRequestUrlHtml: AFMA_buildAdURL({"preqs":12,"session_id":"6802423233789","u_sd":2,"seq_num":"13","slotname":"MY PRIVATE KEY!!","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});

How can I disable these messages?

edit:

This how my proguard config looks like

-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(...);
}
like image 744
code511788465541441 Avatar asked Jan 31 '26 12:01

code511788465541441


1 Answers

Check the following answer where debug and verbose logs are disabled in the proguard.cfg file using:

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

You can use this to also block INFO log message by using:

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

Edit: Note that although the messages won't be logged, the strings are still in the generated bytecode. See this answer for more info.

like image 115
Jeffrey Klardie Avatar answered Feb 02 '26 02:02

Jeffrey Klardie



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!