Query Couchbase Server from Android Application

Hi everyone,

I am new to Couchbase and I’d like to ask for help.

I am currently developing a simple Android survey application (my first application), where users can take a survey I created. Every user has its own account with username and password. I’m using Android Studio with Java.

I’m using Couchbase Mobile, so I use Couchbase Lite to store survey replies and user credentials, Sync Gateway to have a Replication to Couchbase Server, that stores every credential and every survey reply of every user.

Before logging in, I want to check if the credentials are correct, so I have to query Couchbase Server.
Before registering for a new user, I want to check if there is already an user with that username, so I have to query Couchbase Server.

My problem is that I don’t know how to query Couchbase Server from the Android application. I tried Query and QueryBuilder, but I realized that in this way I’m querying Couchbase Lite and not Couchbase Server.
I thought about using a Pull Replicator, but I don’t know how to set filters for this Replicator, in order to get only the data I need (i.e. credentials for a specific username when used for login to check if the credentials are correct, or if a username is already present when the user tries to register a new account).
I tried to use Java SDK and so the N1QL query language, but it messes up my application, because with that I have more than 64K methods, so I have to enable multidex, but then I get the error “Didn’t find class on path: dexpathlist”, when in reality I checked for that class and it is present in dex files. I didn’t know how to solve this, so I’d like to avoid this way of querying Couchbase Server.

Is there any other solution I am not aware of?

Thank you very much.

Please go through some helpful documentation page:

SG Authentication:

For routing your data(specific to a user or a group), please go through Channels:

Android replication with replication filters:

Android queries on database:

Can you add the tag Couchbase Lite