Android应用判断是否是Debug模式

2019-07-26  本文已影响0人  Brian512

判断是否为debug包:

    private static int sIsDebugMode = -1;
    public static boolean isDebugMode(Context context) {
        if (sIsDebugMode == -1) {
            boolean isDebug = context.getApplicationInfo() != null
                    && (context.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
            sIsDebugMode = isDebug ? 1 : 0;
        }
        return sIsDebugMode == 1;
    }

参考文章:https://www.cnblogs.com/zhujiabin/p/6874508.html

上一篇 下一篇

猜你喜欢

热点阅读