[
https://issues.apache.org/jira/browse/KAFKA-7025?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17390988#comment-17390988
]
Nikolai Lubiagov edited comment on KAFKA-7025 at 7/31/21, 3:52 PM:
-------------------------------------------------------------------
I comment this code and now it can compiled for Android API 23 version.
So also
https://github.com/apache/kafka/blob/99b9b3e84f4e98c3f07714e1de6a139a004cbc5b/clients/src/main/java/org/apache/kafka/common/utils/Crc32C.java#L100
at this line.
diff --git
a/clients/src/main/java/org/apache/kafka/common/utils/ByteBufferUnmapper.java
b/clients/src/main/java/org/apache/kafka/common/utils/ByteBufferUnmapper.java
index 4777f7bf96..68452d1691 100644
---
a/clients/src/main/java/org/apache/kafka/common/utils/ByteBufferUnmapper.java
+++
b/clients/src/main/java/org/apache/kafka/common/utils/ByteBufferUnmapper.java
@@ -77,11 +77,11 @@ public final class ByteBufferUnmapper {
if (UNMAP == null)
throw UNMAP_NOT_SUPPORTED_EXCEPTION;
- try {
- UNMAP.invokeExact(buffer);
- } catch (Throwable throwable) {
- throw new IOException("Unable to unmap the mapped buffer: " +
resourceDescription, throwable);
- }
+// try {
+// UNMAP.invokeExact(buffer);
+// } catch (Throwable throwable) {
+// throw new IOException("Unable to unmap the mapped buffer: " +
resourceDescription, throwable);
+// }
}
private static MethodHandle lookupUnmapMethodHandle() {
diff --git a/clients/src/main/java/org/apache/kafka/common/utils/Crc32C.java
b/clients/src/main/java/org/apache/kafka/common/utils/Crc32C.java
index dfe22e8b35..13a76e26f6 100644
--- a/clients/src/main/java/org/apache/kafka/common/utils/Crc32C.java
+++ b/clients/src/main/java/org/apache/kafka/common/utils/Crc32C.java
@@ -96,12 +96,13 @@ public final class Crc32C {
@Override
public Checksum create() {
- try {
+ return null;
+/* try {
return (Checksum) CONSTRUCTOR.invoke();
} catch (Throwable throwable) {
// Should never happen
throw new RuntimeException(throwable);
- }
+ }*/
}
}
But normal work on any version android it will not, becouse... has not
javax.management and java.lang.management. Possible can insert stubs instead of
them, which do nothing... But they will not work in their pure form.
was (Author: lubagov):
I comment this code and now it can compiled for Android API 23 version.
diff --git
a/clients/src/main/java/org/apache/kafka/common/utils/ByteBufferUnmapper.java
b/clients/src/main/java/org/apache/kafka/common/utils/ByteBufferUnmapper.java
index 4777f7bf96..68452d1691 100644
---
a/clients/src/main/java/org/apache/kafka/common/utils/ByteBufferUnmapper.java
+++
b/clients/src/main/java/org/apache/kafka/common/utils/ByteBufferUnmapper.java
@@ -77,11 +77,11 @@ public final class ByteBufferUnmapper {
if (UNMAP == null)
throw UNMAP_NOT_SUPPORTED_EXCEPTION;
- try {
- UNMAP.invokeExact(buffer);
- } catch (Throwable throwable) {
- throw new IOException("Unable to unmap the mapped buffer: " +
resourceDescription, throwable);
- }
+// try {
+// UNMAP.invokeExact(buffer);
+// } catch (Throwable throwable) {
+// throw new IOException("Unable to unmap the mapped buffer: " +
resourceDescription, throwable);
+// }
}
private static MethodHandle lookupUnmapMethodHandle() {
diff --git a/clients/src/main/java/org/apache/kafka/common/utils/Crc32C.java
b/clients/src/main/java/org/apache/kafka/common/utils/Crc32C.java
index dfe22e8b35..13a76e26f6 100644
--- a/clients/src/main/java/org/apache/kafka/common/utils/Crc32C.java
+++ b/clients/src/main/java/org/apache/kafka/common/utils/Crc32C.java
@@ -96,12 +96,13 @@ public final class Crc32C {
@Override
public Checksum create() {
- try {
+ return null;
+/* try {
return (Checksum) CONSTRUCTOR.invoke();
} catch (Throwable throwable) {
// Should never happen
throw new RuntimeException(throwable);
- }
+ }*/
}
}
But normal work on any version android it will not, becouse... has not
javax.management and java.lang.management. Possible can insert stubs instead of
them, which do nothing... But they will not work in their pure form.
> Android client support
> ----------------------
>
> Key: KAFKA-7025
> URL: https://issues.apache.org/jira/browse/KAFKA-7025
> Project: Kafka
> Issue Type: Bug
> Components: clients
> Affects Versions: 1.0.1
> Reporter: Martin Vysny
> Priority: Major
> Attachments: image-2020-07-21-06-42-03-140.png
>
>
> Adding kafka-clients:1.0.0 (also 1.0.1 and 1.1.0) to an Android project would
> make the compilation fail: com.android.tools.r8.ApiLevelException:
> MethodHandle.invoke and MethodHandle.invokeExact are only supported starting
> with Android O (--min-api 26)
>
> Would it be possible to make the kafka-clients backward compatible with
> reasonable Android API (say, 4.4.x) please?
--
This message was sent by Atlassian Jira
(v8.3.4#803005)