From e61a9ce7c17011a9b2b052a31207191eba543266 Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Thu, 26 Apr 2012 16:30:46 +0300 Subject: [PATCH] Make sure netty detects the right java version when running on android. See #282 --- .../main/java/io/netty/util/internal/DetectionUtil.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/common/src/main/java/io/netty/util/internal/DetectionUtil.java b/common/src/main/java/io/netty/util/internal/DetectionUtil.java index 578d5b0401..b16bca6298 100644 --- a/common/src/main/java/io/netty/util/internal/DetectionUtil.java +++ b/common/src/main/java/io/netty/util/internal/DetectionUtil.java @@ -75,6 +75,15 @@ public final class DetectionUtil { } private static int javaVersion0() { + try { + // Check if its android, if so handle it the same way as java6. + // + // See https://github.com/netty/netty/issues/282 + Class.forName("android.app.Application"); + return 6; + } catch (ClassNotFoundException e) { + //Ignore + } try { Deflater.class.getDeclaredField("SYNC_FLUSH"); return 7;