Removing Android Log Messages

Product(s)
Brightcove Player
Video Cloud
Role(s)
Device SDK Developer
Topic(s)
Troubleshooting/Error Handling
SDK
Android

In this topic, you will learn how to remove the log messages from the Brightcove Native Player SDK for Android.

Test your video apps with the default log messages to assist with debugging. When you are ready to publish your app, then you can remove these log messages.

Remove log messages

To remove the default log messages from the Native SDK for Android, follow these steps:

  1. In your app, open the proguard-rules.pro file.

  2. Add the following code block to remove the log from your app:
    -assumenosideeffects class android.util.Log {
      public static *** v(...);
      public static *** d(...);
      public static *** i(...);
      public static *** w(...);
      public static *** e(...);
    }
    
  3. Next, open your app's build.gradle file.
  4. In the buildTypes section, add the minifyEnabled attribute with a value of true.
  5. Below the previous code, add a proguardFiles attribute as follows:
    • Use the getDefaultProguardFile() method to get the proguard-android-optimize.txt file from the Android SDK.
    • Reference the proguard-rules.pro file.

    Your build.gradle file should look similar to this:
    android {
        compileSdkVersion 25
        buildToolsVersion '25.0.0'
    
        defaultConfig {
            ...
        }
    
        buildTypes {
            release {
                minifyEnabled true
                proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'),
                'proguard-rules.pro'
            }
        }
    }