{"record":{"id":"3f5c87c887fb66c0","repo":"slint-ui/slint","slug":"cannot-create-output-directory-out-class-dir-e","errorCode":null,"errorMessage":"Cannot create output directory {out_class_dir:?} - {e}","messagePattern":"Cannot create output directory (.+?) - (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/backends/android-activity/build.rs","lineNumber":32,"sourceCode":"    }\n    let release_mode = env::var(\"PROFILE\").as_ref().map(|s| s.as_str()) == Ok(\"release\");\n\n    // This is the only Java source file\n    let java_src = \"SlintAndroidJavaHelper.java\";\n    let java_src_path = format!(\"java/{java_src}\");\n\n    let slint_path: PathBuf = [\"dev\", \"slint\", \"android-activity\"].iter().collect();\n\n    let out_dir: PathBuf = env::var_os(\"OUT_DIR\").unwrap().into();\n    let mut out_class_dir = out_dir.clone();\n    out_class_dir.push(\"java\");\n    out_class_dir.push(slint_path);\n\n    if out_class_dir.try_exists().unwrap_or(false) {\n        let _ = std::fs::remove_dir_all(&out_class_dir);\n    }\n    std::fs::create_dir_all(&out_class_dir)\n        .unwrap_or_else(|e| panic!(\"Cannot create output directory {out_class_dir:?} - {e}\"));\n\n    let android_jar = android_build::android_jar(None).expect(\"No Android platforms found\");\n\n    // Compile the Java file into .class files\n    let o = JavaBuild::new()\n        .file(&java_src_path)\n        .class_path(&android_jar)\n        .classes_out_dir(&out_class_dir)\n        .java_source_version(8)\n        .java_target_version(8)\n        .debug_info(android_build::DebugInfo {\n            line_numbers: !release_mode,\n            variables: !release_mode,\n            source_files: !release_mode,\n        })\n        .command()\n        .unwrap_or_else(|e| panic!(\"Could not generate the java compiler command: {e}\"))\n        .args([\"-encoding\", \"UTF-8\"])","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/slint-ui/slint/blob/bb937076de3f7919766c1f25e2e969367cf77e9a/internal/backends/android-activity/build.rs#L14-L50","documentation":"The android-activity backend build script fails when it cannot create the directory into which the compiled Java class files go (OUT_DIR plus the slint class path). Any create_dir_all error (permissions, a conflicting file, disk space) panics with this message and aborts the Android backend build.","triggerScenarios":"Building the android-activity crate where `std::fs::create_dir_all(&out_class_dir)` fails — read-only OUT_DIR, stale file at the class dir path, or ENOSPC.","commonSituations":"CI runners with restricted write permissions; a previous build left a file (not directory) at that path; disk quota exceeded during Android toolchain builds.","solutions":["Make the build output directory (OUT_DIR/target) writable by the build user","Delete any non-directory file occupying the class output path and rebuild","Free disk space if the error is ENOSPC","Run `cargo clean -p slint-backend-android-activity` and rebuild"],"exampleFix":"// before: permission denied\n# chmod -R u+w target/ && cargo build\n// after\nbuild succeeds creating the class directory","handlingStrategy":"validation","validationCode":"import os\nout_class_dir = os.path.join(os.environ[\"OUT_DIR\"], \"slint\")\nassert os.access(os.path.dirname(out_class_dir), os.W_OK), \"OUT_DIR not writable\"\nassert not os.path.isfile(out_class_dir), f\"{out_class_dir} is a file, not a directory\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ensure CI runners grant write access to target/ and OUT_DIR","Clean stale artifacts rather than hand-creating files under OUT_DIR","Check disk space for Android builds"],"tags":["android","build-script","filesystem","java"],"backgroundTag":"mkdir-permission-denied","analyzedSha":"bb937076de3f7919766c1f25e2e969367cf77e9a","analyzedAt":"2026-09-16T01:37:20.251Z","contentChangedAt":"2026-09-16T01:37:20.251Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}