Troubleshooting

In this article, you will learn how to receive errors reported by Nimbus, enable or disable test mode, how to set up ProGuard/R8 for code obfuscation, and troubleshoot any other issues that may appear

Logging

Logging is disabled by default so as not to affect production apps.

To receive logs from the Nimbus SDK, call Nimbus.addLogger() and provide an implementation of the Logger interface. Nimbus provides a default logger implementation which will write the output to the console.

Nimbus.addLogger { priority, message ->
    // Your Logging code here
}

// or

Nimbus.addLogger(Nimbus.Logger.Default(Log.INFO)) // To print to the console at the Info level

Debugging Nimbus Errors

All NimbusError objects may optionally wrap an inner exception explaining the cause of the error. For more details on an error use the following code in your error listeners

override fun onError(error: NimbusError) {
    if (error.cause != null) {
        TODO("Check nested error details here")
    }       
}

Test Mode

To receive test ads, call Nimbus.setTestMode(true); this will bypass the live auction and return test creatives based on the requests sent to Nimbus.

Proguard/R8

If using Proguard, include the following rules in your proguard config file:

-keepattributes Signature, *Annotation*

-keep class com.google.ads.interactivemedia.** { *; }
-keep class com.google.obf.** { *; }
-keep class * extends java.util.ListResourceBundle {
    protected Object[][] getContents();
}

-keepnames class okhttp3.internal.publicsuffix.PublicSuffixDatabase
-dontwarn org.codehaus.mojo.animal_sniffer.*
-dontwarn okhttp3.internal.platform.ConscryptPlatform
-dontwarn sun.misc.**
-dontwarn javax.annotation.**

-keepclassmembers class com.adsbynimbus.openrtb.request.** {
    public *;
}

-keepclassmembers class com.adsbynimbus.openrtb.response.** {
    public *;
}

-keep class * extends com.adsbynimbus.internal.Component { public *; }
-keepclassmembers class com.adsbynimbus.render.internal.NimbusWebViewClient { *; }

# If using the Nimbus GAM Adapter
-keep class com.adsbynimbus.google.NimbusCustomEvent {
    <methods>;
    !static <methods>;
}

Last updated