Nextcloud Android library — the networking/SDK layer (RemoteOperations against Nextcloud/OCS
APIs) consumed by the Nextcloud Android app. Mixed Java + Kotlin; new code is Kotlin.
AGENTS.md is the source of truth for adding or changing network endpoints — package
layout, the RemoteOperation template, error handling, serialization, constants, and the detekt
thresholds that gate CI. Follow it for any endpoint work. The canonical reference implementation is
library/src/main/java/com/nextcloud/android/lib/resources/governance/.
- Remote operations:
library/src/main/java/com/nextcloud/android/lib/resources/<feature>/ - Wire models/enums:
…/resources/<feature>/model/ - Shared OCS types:
com.owncloud.android.lib.ocs—OcsResponse<T>/Ocs<T>envelope,ocsJson(strictJson),SEPARATOR("/") - Unit tests:
library/src/test/java/…· instrumented tests:library/src/androidTest/java/…
./gradlew :library:compileDebugKotlin
./gradlew :library:testDebugUnitTest --tests "com.nextcloud.android.lib.resources.governance.*"
./gradlew :library:detekt- kotlinx.serialization, not Gson. The compiler plugin is applied in
library/build.gradle; thekotlinx-serialization-jsonruntime dependency alone is not enough — both are required. - detekt (
library/detekt.yml) is strict on operations:ReturnCount: max 2,TooGenericExceptionCaughtactive (needs@Suppressonrun()),ThrowsCount: max 2. AGENTS.md shows the two-return / single-catch pattern that satisfies these. - Line length 120 (
.editorconfig); import ordering is disabled — don't reorder imports. :library:spotlessKotlinCheckcurrently fails at configuration time (a spotbugs/AGP issue, not your code). Verify Kotlin formatting by hand against the 120-char limit and the AGENTS.md patterns.RemoteOperationResult.logMessageis a deprecated Java accessor — suppress at the call site only (@Suppress("DEPRECATION")on thefailure(...)helper), never globally.
- Kotlin only for new classes; don't add Java classes. Java 17 is available for editing existing Java.
- Keep diffs minimal and focused; don't reformat or refactor unrelated code.
- Only commit or push when asked.