# 0.2.1 — PDF instrumentation-test compilation fix The reported failure was in `:androidApp:compileDebugAndroidTestKotlin`, at the `PdfDocument().use` expression in `ViewerSmokeTest.kt`. ## Cause Android's `android.graphics.pdf.PdfDocument` has a `close()` method, but does not implement `java.io.Closeable` or `java.lang.AutoCloseable`. The Kotlin standard library's `use` extensions require one of these interfaces. A method named `close` is not sufficient. The type-parameter R diagnostic is a consequence of the invalid receiver; explicit type arguments or dependency upgrades are not the fix. ## Correction The PDF fixture now uses explicit `try/finally`: finish the started page, write the PDF through an output stream (which can still use `use`), and close the document. A unique temporary fixture is deleted even when setup or rendering throws; the render client also retains explicit cleanup. Existing test assertions are retained. No runtime feature or dependency changes were made. The complete source release increments versionCode to 3 / versionName to 0.2.1 and updates validation documents. The one-file patch changes only ViewerSmokeTest.kt, so it can be applied without updating version metadata or replacing other locally modified files. ## Apply to a local 0.2.0 checkout Replace `androidApp/src/androidTest/kotlin/dev/fileworkbench/android/ViewerSmokeTest.kt` with the supplied fixed file, or run `git apply` with the supplied one-file patch. The patch was checked against the exact test in the supplied 0.2.0 source archive. Then run from PowerShell at the repository root: ```powershell .\gradlew.bat :androidApp:compileDebugAndroidTestKotlin .\gradlew.bat :core:jvmTest :platform-jvm:test :androidApp:assembleDebug :androidApp:assembleDebugAndroidTest :androidApp:lintDebug ``` The first command retries the failed compilation task. The second continues full build validation. These do not run the instrumentation tests on a device; that requires `:androidApp:connectedDebugAndroidTest` with a connected device/emulator. ## Verification boundary See `VALIDATION.md`. The portable checks and syntax checks passed here. The Android compilation retry stopped at Gradle-wrapper download with a DNS error before the compiler ran; no APK or device-test success is claimed. ## Primary API references - Android PdfDocument API: https://developer.android.com/reference/android/graphics/pdf/PdfDocument - Kotlin Closeable.use: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.io/use.html - Kotlin AutoCloseable.use: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/use.html