This is my code:
MongoClientURI uri = new MongoClientURI("mongodb+srv://username:password@smarthome.sg2qb.mongodb.net/Smarthome?retryWrites=true&w=majority" );
MongoClient mongoClient = new MongoClient(uri);
MongoDatabase db = mongoClient.getDatabase(uri.getDatabase());
And i have this exception: javax.naming.NamingException
java.lang.NoClassDefFoundError: Failed resolution of: Ljavax/naming/directory/InitialDirContext;
Does anyone know if there is another way to connect android studio with mongodb-atlas?