[ 
https://issues.apache.org/jira/browse/KAFKA-7025?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17308102#comment-17308102
 ] 

Nikolai Lubiagov edited comment on KAFKA-7025 at 3/25/21, 10:07 AM:
--------------------------------------------------------------------

For me interested other question, how it may working without javax.management.* 
, on any Android version? I get, this errors, because this is not part of 
Android Java.

 
{code:java}
java.lang.ClassNotFoundException: Didn't find class 
"javax.management.DynamicMBean" 
Caused by: java.lang.ClassNotFoundException: Didn't find class 
"java.lang.management.ManagementFactory"
{code}
 

i append in Gradle build script this line import client library:
{code:java}
implementation 'org.apache.kafka:kafka-clients:2.7.0'{code}
It is on Android 9 device and API28, when i try to create producer...
{code:java}
String server = "192.168.2.10:9092";
String topicName = "chat_topic";

void initKafkaProducer(){
 final Properties props = new Properties();
 props.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, server);
 props.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, 
LongSerializer.class.getName());
 props.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, 
StringSerializer.class.getName());
 producer= new KafkaProducer<>(props);
}{code}
 
 Although several classes of "stubs" instead of missing ones. make it work, and 
it seems these metrics are not strictly necessary. But originally, it doesn't 
work even if compiled, for Android API level 26 or newer.

On Android 7 (24 API), i really have this problem, like in this topic in build 
time.

About version Kafka 3.0, from trunk, i still can see this error:
{code:java}
com.android.tools.r8.a: MethodHandle.invoke and MethodHandle.invokeExact are 
only supported starting with Android O (--min-api 26){code}
but, before it was related on 2 library *kafka-clients-2.7.0* and 
*snappy-java-1.1.7.7*. For now it dependent only to 
*kafka-clients-3.0.0-SNAPSHOT.jar*, and have no problem with snappy.


was (Author: lubagov):
For me interested other question, how it may working without javax.management.* 
, on any Android version? I get, this errors, because this is not part of 
Android Java.

 
{code:java}
java.lang.ClassNotFoundException: Didn't find class 
"javax.management.DynamicMBean" 
Caused by: java.lang.ClassNotFoundException: Didn't find class 
"java.lang.management.ManagementFactory"
{code}
 

i append in Gradle build script this line import client library:
{code:java}
implementation 'org.apache.kafka:kafka-clients:2.7.0'{code}
It is on Android 9 device and API28, when i try to create producer...
{code:java}
String server = "192.168.2.10:9092";
String topicName = "chat_topic";

void initKafkaProducer(){
 final Properties props = new Properties();
 props.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, server);
 props.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, 
LongSerializer.class.getName());
 props.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, 
StringSerializer.class.getName());
 producer= new KafkaProducer<>(props);
}{code}
 
 Although several classes of "stubs" instead of missing ones. make it work, and 
it seems these metrics are not strictly necessary. But originally, it doesn't 
work even if compiled, for Android API level 26 or newer.

On Android 7 (24 API), i really have this problem, like in this topic in build 
time.

> 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
>             Fix For: 3.0.0
>
>         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)

Reply via email to