There is a workaround with reflection to get the BuildConfig value of the project (not the library):
public static Object getBuildConfigValue(Context context, String fieldName) { try { Class<?> clazz = Class.forName(context.getPackageName() + ".BuildConfig"); Field field = clazz.getField(fieldName); return field.get(null); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (NoSuchFieldException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } return null; }
To get the DEBUG field, for example, just call this from the Activity library:
boolean debug = (Boolean) getBuildConfigValue(this, "DEBUG");
I have not tried this yet and cannot guarantee that it will work all the time, but you can go ahead.
source share