Regarding the “record desugaring” error, I suspect the cause is the introduction of support for Java records in the 4.6 release. You might try excluding the bson-record-codec artifact, e.g.

        <dependency>
            <groupId>org.mongodb</groupId>
            <artifactId>mongodb-driver-sync</artifactId>
            <version>${driverVersion}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.mongodb</groupId>
                    <artifactId>bson-record-codec</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

If someone could test that and report back, it might help others on this thread.

Regarding the support for “mongodb+srv” connection string, I suspect the cause is the driver’s reliance on JNDI to look up SRV records, which last I checked is not supported in Android. But it’s not enough to remove the “+srv” from the connection string. You need a different connection string that contains the actual host names of the cluster, rather than the SRV host name, which is different. If you’re using MongoDB Atlas, there should be a way to get both an SRV and non-SRV connection string in the Atlas web UI.

Regarding general support for Android: the Java driver is not tested on Android. It may work but we don’t make any effort to ensure that it does. The driver assumes it’s running on a standard JVM, and insofar as Android emulates one it should work, but it’s not considered a supported platform.

Regards,
Jeff Yemin