Doc with invalid id from CBL 1.x crashes app when upgrading to CBL 2.x

Setup:
CBL 2.6 Android

Stacktrace:

2019-10-29 19:49:51.680 W/System.err: CouchbaseLiteException{CouchbaseLite,30,'Error upgrading database: Invalid docID "_local/my_doc_id", converting doc "_local/my_doc_id"'}
2019-10-29 19:49:51.681 W/System.err:     at com.couchbase.lite.CBLStatus.convertException(CBLStatus.java:81)
2019-10-29 19:49:51.681 W/System.err:     at com.couchbase.lite.CBLStatus.convertException(CBLStatus.java:32)
2019-10-29 19:49:51.681 W/System.err:     at com.couchbase.lite.AbstractDatabase.open(AbstractDatabase.java:1012)
2019-10-29 19:49:51.681 W/System.err:     at com.couchbase.lite.AbstractDatabase.<init>(AbstractDatabase.java:289)
2019-10-29 19:49:51.681 W/System.err:     at com.couchbase.lite.Database.<init>(Database.java:62)

The document with id _local/my_doc_id was created in CBL 1.x. At the time I wrongly used the prefix _local/ and assumed it will be created as a local document. I later learned that I needed to use the appropriate method provided by the CBL 1.x SDK. Unfortunately the document with the invalid id is still around.

The automatic upgrade fails, opening the database is impossible. It is also impossible to delete the invalid document because the database needs to be opened to do so. It’s a catch 22.

Another possibility is to release an app update with CBL 1.x, find invalid docs, delete them, release an app update with CBL 2.x. That’s not possible either as some users already have the CBL 2.x database and there is no automatic downgrade to a CBL 1.x database. I’m stuck!

Here is a patch on Github from Jens and Pasin that skipped design docs. Here are all added changes:

                if (docID.hasPrefix("_design/"_sl)) {
                    Warn("Skipping doc '%.*s': Design docs are not supported", SPLAT(docID));
                    continue;
                }

Is my best bet to learn how to compile CBL core and CBL Android and simply add a check for “_local/” doc IDs?

Thanks!

I tried building the Android aar file but failed. Here’s what I have got so far:

  1. Cloned CE github repo and submodules: https://github.com/couchbase/couchbase-lite-android-ce
  2. Opened couchbase-lite-android-ce in Android Studio
  3. Downloaded CMake
  4. On Windows entered gradlew.bat assemble in terminal. Here it failed. Output is below
FAILURE: Build failed with an exception.

* Where:
Settings file 'C:\<folder>\couchbase-lite-android-ce\settings.gradle' line: 1

* What went wrong:
A problem occurred evaluating settings 'couchbase-lite-android-ce'.
> Could not get unknown property 'couchbase' for settings 'couchbase-lite-android-ce' of type org.gradle.initialization.DefaultSettings.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 0s

Building it with gradlew.bat assemble --stacktrace

FAILURE: Build failed with an exception.

* Where:
Settings file 'C:\<folder>\couchbase-lite-android-ce\settings.gradle' line: 1

* What went wrong:
A problem occurred evaluating settings 'couchbase-lite-android-ce'.
> Could not get unknown property 'couchbase' for settings 'couchbase-lite-android-ce' of type org.gradle.initialization.DefaultSettings.

* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Exception is:
org.gradle.api.GradleScriptException: A problem occurred evaluating settings 'couchbase-lite-android-ce'.
        at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:92)
        at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl$2.run(DefaultScriptPluginFactory.java:221)
        at org.gradle.configuration.DefaultScriptTarget.addConfiguration(DefaultScriptTarget.java:74)
        at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:226)
        at org.gradle.configuration.BuildOperationScriptPlugin$1$1.run(BuildOperationScriptPlugin.java:69)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:402)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:394)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:92)
        at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
        at org.gradle.configuration.BuildOperationScriptPlugin$1.execute(BuildOperationScriptPlugin.java:66)
        at org.gradle.configuration.BuildOperationScriptPlugin$1.execute(BuildOperationScriptPlugin.java:63)
        at org.gradle.configuration.internal.DefaultUserCodeApplicationContext.apply(DefaultUserCodeApplicationContext.java:48)
        at org.gradle.configuration.BuildOperationScriptPlugin.apply(BuildOperationScriptPlugin.java:63)
        at org.gradle.initialization.ScriptEvaluatingSettingsProcessor.applySettingsScript(ScriptEvaluatingSettingsProcessor.java:69)
        at org.gradle.initialization.ScriptEvaluatingSettingsProcessor.process(ScriptEvaluatingSettingsProcessor.java:61)
        at org.gradle.initialization.PropertiesLoadingSettingsProcessor.process(PropertiesLoadingSettingsProcessor.java:37)
        at org.gradle.initialization.SettingsEvaluatedCallbackFiringSettingsProcessor.process(SettingsEvaluatedCallbackFiringSettingsProcessor.java:34)
        at org.gradle.initialization.RootBuildCacheControllerSettingsProcessor.process(RootBuildCacheControllerSettingsProcessor.java:36)
        at org.gradle.initialization.BuildOperationSettingsProcessor$2.call(BuildOperationSettingsProcessor.java:50)
        at org.gradle.initialization.BuildOperationSettingsProcessor$2.call(BuildOperationSettingsProcessor.java:47)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
        at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
        at org.gradle.initialization.BuildOperationSettingsProcessor.process(BuildOperationSettingsProcessor.java:47)
        at org.gradle.initialization.DefaultSettingsLoader.findSettingsAndLoadIfAppropriate(DefaultSettingsLoader.java:104)
        at org.gradle.initialization.DefaultSettingsLoader.findAndLoadSettings(DefaultSettingsLoader.java:45)
        at org.gradle.initialization.SettingsAttachingSettingsLoader.findAndLoadSettings(SettingsAttachingSettingsLoader.java:35)
        at org.gradle.internal.composite.CommandLineIncludedBuildSettingsLoader.findAndLoadSettings(CommandLineIncludedBuildSettingsLoader.java:34)
        at org.gradle.internal.composite.ChildBuildRegisteringSettingsLoader.findAndLoadSettings(ChildBuildRegisteringSettingsLoader.java:47)
        at org.gradle.internal.composite.CompositeBuildSettingsLoader.findAndLoadSettings(CompositeBuildSettingsLoader.java:35)
        at org.gradle.initialization.DefaultGradleLauncher$LoadBuild.run(DefaultGradleLauncher.java:277)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:402)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:394)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:92)
        at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
        at org.gradle.initialization.DefaultGradleLauncher.loadSettings(DefaultGradleLauncher.java:202)
        at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:147)
        at org.gradle.initialization.DefaultGradleLauncher.executeTasks(DefaultGradleLauncher.java:134)
        at org.gradle.internal.invocation.GradleBuildController$1.execute(GradleBuildController.java:58)
        at org.gradle.internal.invocation.GradleBuildController$1.execute(GradleBuildController.java:55)
        at org.gradle.internal.invocation.GradleBuildController$3.create(GradleBuildController.java:82)
        at org.gradle.internal.invocation.GradleBuildController$3.create(GradleBuildController.java:75)
        at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:183)
        at org.gradle.internal.work.StopShieldingWorkerLeaseService.withLocks(StopShieldingWorkerLeaseService.java:40)
        at org.gradle.internal.invocation.GradleBuildController.doBuild(GradleBuildController.java:75)
        at org.gradle.internal.invocation.GradleBuildController.run(GradleBuildController.java:55)
        at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:31)
        at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
        at org.gradle.launcher.exec.BuildOutcomeReportingBuildActionRunner.run(BuildOutcomeReportingBuildActionRunner.java:58)
        at org.gradle.tooling.internal.provider.ValidatingBuildActionRunner.run(ValidatingBuildActionRunner.java:32)
        at org.gradle.launcher.exec.BuildCompletionNotifyingBuildActionRunner.run(BuildCompletionNotifyingBuildActionRunner.java:39)
        at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner$3.call(RunAsBuildOperationBuildActionRunner.java:51)
        at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner$3.call(RunAsBuildOperationBuildActionRunner.java:45)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
        at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
        at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner.run(RunAsBuildOperationBuildActionRunner.java:45)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter$1.transform(InProcessBuildActionExecuter.java:49)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter$1.transform(InProcessBuildActionExecuter.java:46)
        at org.gradle.composite.internal.DefaultRootBuildState.run(DefaultRootBuildState.java:78)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:46)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:31)
        at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:42)
        at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:28)
        at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:78)
        at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:52)
        at org.gradle.tooling.internal.provider.SubscribableBuildActionExecuter.execute(SubscribableBuildActionExecuter.java:59)
        at org.gradle.tooling.internal.provider.SubscribableBuildActionExecuter.execute(SubscribableBuildActionExecuter.java:36)
        at org.gradle.tooling.internal.provider.SessionScopeBuildActionExecuter.execute(SessionScopeBuildActionExecuter.java:68)
        at org.gradle.tooling.internal.provider.SessionScopeBuildActionExecuter.execute(SessionScopeBuildActionExecuter.java:38)
        at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:37)
        at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:26)
        at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:43)
        at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:29)
        at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:60)
        at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:32)
        at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:55)
        at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:41)
        at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:48)
        at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:32)
        at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:67)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
        at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
        at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
        at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
        at org.gradle.util.Swapper.swap(Swapper.java:38)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
        at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
        at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:62)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
        at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:81)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
        at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
        at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:295)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
        at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
        at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: groovy.lang.MissingPropertyException: Could not get unknown property 'couchbase' for settings 'couchbase-lite-android-ce' of type org.gradle.initialization.DefaultSettings.
        at org.gradle.internal.metaobject.AbstractDynamicObject.getMissingProperty(AbstractDynamicObject.java:83)
        at org.gradle.groovy.scripts.BasicScript$ScriptDynamicObject.getMissingProperty(BasicScript.java:154)
        at org.gradle.internal.metaobject.AbstractDynamicObject.getProperty(AbstractDynamicObject.java:61)
        at org.gradle.groovy.scripts.BasicScript.getProperty(BasicScript.java:63)
        at settings_8lwqwsl3jlmp9q38azx99p5wq.run(C:\<folder>\couchbase-lite-android-ce\settings.gradle:1)
        at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:90)
        ... 120 more


* Get more help at https://help.gradle.org

BUILD FAILED in 0s

Building it with gradlew.bat assemble --scan

FAILURE: Build failed with an exception.

* Where:
Settings file 'C:\<folder>\couchbase-lite-android-ce\settings.gradle' line: 1

* What went wrong:
A problem occurred evaluating settings 'couchbase-lite-android-ce'.
> Could not get unknown property 'couchbase' for settings 'couchbase-lite-android-ce' of type org.gradle.initialization.DefaultSettings.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 0s

Android Studio tree structure

settings.gradle

Android%20Studio%202

Also ran .\gradlew assemble which had the same output.

.\gradlew -v prints


Gradle 5.4.1

Build time: 2019-04-26 08:14:42 UTC
Revision: 261d171646b36a6a28d5a19a69676cd098a4c19d

Kotlin: 1.3.21
Groovy: 2.5.4
Ant: Apache Ant™ version 1.9.13 compiled on July 10 2018
JVM: 1.8.0_231 (Oracle Corporation 25.231-b11)
OS: Windows 10 10.0 amd64

Yes, unfortunately in this case your only remedy is to try to build yourself. @jens Do you think we should add more checks to our upgrader (maybe any documents that somehow manage to start with an underscore?). @blake.meike Can you help out with the build stuff here?

Yeah… I can help with the build. couchbase-lite-android-ce contains Core as a submodule, and should build from the command line (./gradlew assemble)

I tried this just now again in Android Studios’ terminal window and in msysgit (git for windows). Since you mention the submodule I navigated to it cd couchbase-lite-core/. In this folder there is no gradle wrapper hence I ran ./../gradlew and the output is the same as I posted earlier.

Could not get unknown property ‘couchbase’ for settings ‘couchbase-lite-android-ce’ of type org.gradle.initialization.DefaultSettings.

Running ./../gradlew -v in the subfolder prints the version info.

In my previous post I made a screenshot of settings.gradle as I thought the error message has something to do with it as it complains about a setting.

I also just now tried the same in Windows’ PowerShell. Same results.

Uhhh… no. Don’t do that.

Checkout couchbase-lite-android-ce:

git clone https://github.com/couchbase/couchbase-lite-android-ce.git --recurse-submodules

Edit whatever files you need to edit. I believe they are somewhere in the directory $ROOT/couchbase-lite-core.

When you are done editing build the library:

cd $ROOT/couchbase-lite-android
./gradlew assemble

If all goes well the library will be in:

$ROOT/couchbase-lite-android/lib/build/outputs/aar

Yes, you are right this is the correct folder to run the command in! I tried to assemble in $ROOT/ and in $ROOT/couchbase-lite-core/ yesterday.
Now running ./gradlew assemble in the right path complained about not having a local.properties file in $ROOT/couchbase-lite-android/. I created it and pasted my Android SDK path:
sdk.dir=C:\\Users\\Ben\\AppData\\Local\\Android\\Sdk (Windows machine)

Then another issue shows up: https://gist.github.com/benjaminglatzeder/917c43c6d1b8f33c4c4b579b69910262 (Please see gist as character limit was reached.)

I then edited ~/couchbase-lite-core/build_cmake/scripts/get_repo_version.sh and uncomment the following two lines as it is described in the file:

# To fake an official build for testing purposes, uncomment these two lines:
BLD_NUM=54321
VERSION=abcdefabcdef

(Later I found the file get_repo_version.ps1 as I’m on Windows and edited the file the same way but the build still failed with the same issue.)

This didn’t seem to help but produced a different output: https://gist.github.com/benjaminglatzeder/f6b800df3ea16c3170217216336118ad

So far I ran all of this in mysygit and found in ~/couchbase-lite-core/CMakeLists.txt the following about UNIX and powershell and decided to run assemble in powershell.

# Generate file repo_version.h containing Git repo information, and add it to #include path:
set(GENERATED_HEADERS_DIR "${CMAKE_BINARY_DIR}/generated_headers")
file(MAKE_DIRECTORY "${GENERATED_HEADERS_DIR}")
if (UNIX)
    execute_process(COMMAND /bin/bash "${PROJECT_SOURCE_DIR}/build_cmake/scripts/get_repo_version.sh"
                                      "${GENERATED_HEADERS_DIR}/repo_version.h")
else()
    execute_process(COMMAND powershell "${PROJECT_SOURCE_DIR}/build_cmake/scripts/get_repo_version.ps1"
                                      "${GENERATED_HEADERS_DIR}/repo_version.h")

Output of assemble in powershell: https://gist.github.com/benjaminglatzeder/3fc0ef55b634eaf72508cc810bcc54e4

What should I try next please?

Sorry! I thought I’d replied to this yesterday!

You really shouldn’t need to edit any lines anywhere. You should, simply, run:

./gradlew assemble

from

$ROOT/couchbase-lite-android

… in a clean workspace. You do need to add local.properties, but Android Studio will do that correctly, if you have ever opened the project with it.

I was able to get access to a Mac and building the aar files was extremely easy. I had added few lines of code to skip the _local/ documents and was able to test that these files are skipped and the automatic database upgrade finishes successfully.
After spending much time trying to build it on Windows 10 but failed so far I’d say it is currently not possible without editing files, etc.

My setup is:
Microsoft Windows 10 Pro Build 18362
Android Studio 3.5.1
Build #AI-191.8026.42.35.5900203, built on September 25, 2019
JRE: 1.8.0_202-release-1483-b03 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
Gradle: distributionUrl=https://services.gradle.org/distributions/gradle-5.4.1-all.zip

Differences between 2.7 Snapshot and 2.6.2 download from Github

The 2.7 Snapshot release aar files is 6,334,055 Bytes in size.
The 2.6.2 aar file is ---------------------7,537,394 Bytes in size.

Still all unit tests of my app passed. Continuos syncing as well as one shot pull down sync work just fine. Also I saw okhttp and okio jars in the download 2.6.2 version. I use okhttp 4 instead of 3 and I don’t have the okio jar. The okio dependency might be included in within a different dependency though. Again so far I did not run into any crashes.

If it makes sense to skip _local/ documents when upgrading I’m happy to send a pull request. I’m also happy to help solve issues so that building Couchbase Lite on Windows 10 is straightforward.

Yes, thanks! Actually, could you simplify that to skip all documents whose ID starts with an underscore?

Here is the pull request: https://github.com/couchbase/couchbase-lite-core/pull/871