Q:

Ignore java code from debug library

On my project I have a Stetho Library that I use just in debug compile.  But when I try to generate a release apk, it returns an error when compile javacode saying that the Stetho library couldn`t be found. 
build.gradle
//Stetho Library
debugCompile 'com.facebook.stetho:stetho:1.2.0'
debugCompile('com.parse:parseinterceptors:0.0.1') {
    exclude group: 'com.parse.bolts';
    exclude group: 'com.parse';
}

StethoHelper.java
public class StethoHelper {

  public static void initialize(Context context) {
    com.facebook.stetho.Stetho.initialize(
            com.facebook.stetho. Stetho.newInitializerBuilder(context)
                    .enableDumpapp(com.facebook.stetho. Stetho.defaultDumperPluginsProvider(context))
                    .enableWebKitInspector(com.facebook.stetho. Stetho.defaultInspectorModulesProvider(context))
                    .build());
  }

  public static void addInterceptor(Parse. Configuration. Builder builder) {
    builder.addNetworkInterceptor(new com.parse.interceptors. ParseStethoInterceptor());
  }
}

Ok, this error makes sense, but how can I suppress this error without have to comment my code?  

A:

you are using debugCompile 'com.facebook.stetho:stetho:1.2.0' which will work only for debug apk.  you can change it to compile 'com.facebook.stetho:stetho:1.2.0'. 
though you should not enable stetho in release build for security reasons. 
Here is simple documentation for your reference. 
http://littlerobots.nl/blog/stetho-for-android-debug-builds-only/

