我正在尝试连接mongodb atlas数据库。当我在android模拟器上运行时,它工作正常。但是,当我在android设备上进行调试时,会出现错误。请帮我解决这个问题。
com.example.mongodbdemo I/cluster: Exception in monitor thread while connecting to server democluster-shard-00-01-vdhfp.mongodb.net:27017
com.mongodb.MongoException: java.lang.NoSuchMethodError: No virtual method setEndpointIdentificationAlgorithm(Ljava/lang/String;)V in class Ljavax/net/ssl/SSLParameters; or its super classes (declaration of 'javax.net.ssl.SSLParameters' appears in /system/framework/core-libart.jar)
at com.mongodb.connection.InternalStreamConnection.open(InternalStreamConnection.java:125)
at com.mongodb.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:127)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.NoSuchMethodError: No virtual method setEndpointIdentificationAlgorithm(Ljava/lang/String;)V in class Ljavax/net/ssl/SSLParameters; or its super classes (declaration of 'javax.net.ssl.SSLParameters' appears in /system/framework/core-libart.jar)
at com.mongodb.internal.connection.SslHelper.enableHostNameVerification(SslHelper.java:32)
at com.mongodb.connection.SocketStreamHelper.initialize(SocketStreamHelper.java:47)
at com.mongodb.connection.SocketStream.open(SocketStream.java:58)
at com.mongodb.connection.InternalStreamConnection.open(InternalStreamConnection.java:114)
at com.mongodb.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:127)
at java.lang.Thread.run(Thread.java:818)