Skip to content

Instantly share code, notes, and snippets.

@KimuraTakaumi
Created July 31, 2016 09:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KimuraTakaumi/2f2cb634ad49b11d36d62a64d42ad841 to your computer and use it in GitHub Desktop.
Save KimuraTakaumi/2f2cb634ad49b11d36d62a64d42ad841 to your computer and use it in GitHub Desktop.
AARファイルからアプリのBuildConfigのDEBUGを読み込む
public static boolean isDebug(Context context){
try {
Class<?> clazz = Class.forName(context.getPackageName() + ".BuildConfig");
Field field = clazz.getField("DEBUG");
return (Boolean) field.get(null);
} catch (ClassNotFoundException | NoSuchFieldException | IllegalAccessException e) {
e.printStackTrace();
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment