Hi,
I’m following this tutorial: https://www.mongodb.com/docs/realm/sdk/java/app-services/mongodb-remote-access/
But I keep getting the error: Unable to start activity CoomponentInfo{com.example.querytest3/com.example.querytest3.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method ‘io.realm.mongodb.mongo.MongoClient io.realm.mongodb.User.getMongoClient(java.lang.String)’ on a null object reference
I get that it’s something with the anonymous user, from the code:
User user = app.currentUser();
MongoClient mongoClient =
user.getMongoClient(“mongodb-atlas”);
But how do I fix it? I know very very little about apps, I’m self-taught, and all I need is to learn how the tutorial works. Hopefully someone can help me with an extra line of code here or there? I can’t imagine it’s hard to fix, but I don’t have the experience to fix it, and I’ve literally spent hours searching the web for answers >.<
Thanks!