android 怎么判断是debug包

java里要怎么判断debug包

BuildConfig.DEBUG

/**

  • 判断当前是否是debug模式
  • @param context 上下文
  • @return true或false
    */
    public static boolean isApkInDebug(Context context) {
    try {
    ApplicationInfo info = context.getApplicationInfo();
    return (info.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
    } catch (Exception e) {
    return false;
    }
    }