P2P Sync not happening in Android App

I have done a sample project using Couchbase Lite(CouchBaseLite Version = “3.2.1”) in my Android Project. However, P2P sync is not happening even though all the steps mentioned in the documentation are handled properly. I am getting a couchbaseLite Exception during Replication.

Here is the error :
state changed BUSY => STOPPED(0/0) CouchbaseLiteException{ CouchbaseLite, 26: Invalid getCollections message: not the first message at com.couchbase.lite.ReplicatorStatus. convertC4StatusError( ReplicatorStatus. java: 63) at com.couchbase.lite.ReplicatorStatus. < init> ( ReplicatorStatus. java: 88) at com.couchbase.lite.AbstractReplicator. updateStatus( AbstractReplicator. java: 797) with tag CouchbaseLite/REPLICATOR

Also getting following log in between -
Obj=/JRepl@1954722883/C4RemoteRepl#10/Repl#11/ Got error response: BLIP 400 ‘Invalid getCollections message: not the first message’

Here is the sample project which I have worked on -
https://github.com/krishnachaitanya9984/CouchBaseDemo

Please review the code and let me know if I am missing anything.
Also, let me know your thoughts about the error and how to rectify it.

  • Are the apps on both devices using the same version of CBL?
  • Are you using only the default collection, or multiple collections? Do the databases on each device have the same collections configured?
  • Did you remember to specify which collection(s) to replicate?

(This error is coming from the replication protocol at a pretty low level. I wouldn’t expect it to be visible to the app, and it looks like something that could be a protocol version mismatch, or else a disagreement between the peers about whether they’re syncing non-default collections.)

Hi krinyny,
Thanks for your posting. Is it possible to collect the logs at the Verbose level? I would like to have the logs on both devices (active and passive) ?

Hi Jens,

Pls find the answers here:

  • Are the apps on both devices using the same version of CBL? - Yes same version (3.2.1)

  • Are you using only the default collection, or multiple collections? Do the databases on each device have the same collections configured? - I have a created one collection and used the same collection. Databases on each device have same collection (collection Name is User)

  • Did you remember to specify which collection(s) to replicate? -
    Yes, I have specified the collection in Replicator Config. Below is the code
    val replicator = Replicator(
    ReplicatorConfigurationFactory.newConfig(
    target = messageEndPoint,
    collections = mapOf(db.collections to null),
    type = ReplicatorType.PUSH_AND_PULL
    )
    )

Do the collections has one collection or multiple collections?
Also, if you. could provide the logs that would be very helpful.

@jianminzhao It has only one collection by Name - User

PassivePeerLogs

ActivePeerLogs

Hi @krinyny thank you for your time to collect the logs. I found that in the ActivePeerLogs, there are BLIP messages, such as " SENDING: REQ #0", but in PassivePeerLogs, the logs ended without any BLIP messages. Can you double check the logs from the Passive Peer? Who does the Active Peer talk to?