@SuppressLint("NewApi") private static boolean testLib() { if (nativeIntField == null) { return false; } Bitmap bitmap = null; Canvas canvas = null; try { bitmap = createNativeBitmap(2, 2, Bitmap.Config.ARGB_8888, true); boolean result = (bitmap != null && bitmap.getWidth() == 2 && bitmap.getHeight() == 2); if (result) { if (android.os.Build.VERSION.SDK_INT >= 17 && !bitmap.isPremultiplied()) { bitmap.setPremultiplied(true); } canvas = new Canvas(bitmap); Paint paint = new Paint(); paint.setColor(Color.RED); paint.setTextSize(20f); canvas.drawRect(0f, 0f, (float) bitmap.getWidth(), (float) bitmap.getHeight(), paint); canvas.drawText("TestLib", 0, 0, paint); if (android.os.Build.VERSION.SDK_INT >= 17) { result = bitmap.isPremultiplied(); } } return result; } catch (Exception e) { Log.e("NativeBitmapFactory", "exception:" + e.toString()); return false; } catch (Error e) { return false; } finally { if (bitmap != null) { bitmap.recycle(); bitmap = null; } } }