{"record":{"id":"fce6cf6e00d35967","repo":"iBotPeaches/Apktool","slug":"could-not-create-framework-directory","errorCode":null,"errorMessage":"Could not create framework directory: ","messagePattern":"Could not create framework directory: ","errorType":"exception","errorClass":"AndrolibException","httpStatus":null,"severity":"error","filePath":"brut.apktool/apktool-lib/src/main/java/brut/androlib/res/Framework.java","lineNumber":156,"sourceCode":"        return table;\n    }\n\n    public File getDirectory() throws AndrolibException {\n        if (mDirectory == null) {\n            String path = mConfig.getFrameworkDirectory();\n            File dir = (path != null && !path.isEmpty()) ? new File(path) : DEFAULT_DIRECTORY;\n\n            if (dir.exists() && !dir.isDirectory()) {\n                throw new AndrolibException(\"Framework path is not a directory: \" + dir);\n            }\n\n            File parent = dir.getParentFile();\n            if (parent != null && parent.exists() && !parent.isDirectory()) {\n                throw new AndrolibException(\"Framework path's parent is not a directory: \" + parent);\n            }\n\n            if (!dir.exists() && !dir.mkdirs()) {\n                throw new AndrolibException(\"Could not create framework directory: \" + dir);\n            }\n\n            mDirectory = dir;\n        }\n\n        return mDirectory;\n    }\n\n    public File getApkFile(int id) throws AndrolibException {\n        return getApkFile(id, mConfig.getFrameworkTag());\n    }\n\n    public File getApkFile(int id, String tag) throws AndrolibException {\n        File dir = getDirectory();\n        File apkFile = new File(dir, id + getApkSuffix(tag));\n        if (apkFile.exists()) {\n            return apkFile;\n        }","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/iBotPeaches/Apktool/blob/79b63384d7d7e22917e6ea8b453272da7012515b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/Framework.java#L138-L174","documentation":"AndrolibException from Framework.getDirectory() when the framework directory does not exist and File.mkdirs() fails to create it. mkdirs() returns false on permission denial, read-only filesystems, or when an ancestor turns out to be a file (race). Without the directory, framework APKs (1.apk, tagged variants) cannot be written, so framework installation/lookup aborts.","triggerScenarios":"Setting --frame-path under a directory the user cannot write (e.g. /usr/share/... without root); read-only mounts (container images, Live CDs); SELinux denying mkdir on the chosen location.","commonSituations":"Running apktool as non-root with system-wide frame paths; Docker containers with read-only volumes; hardened macOS SIP locations; disk quota exhausted.","solutions":["Use a writable location: `apktool if fw.apk --frame-path ~/.local/share/apktool/framework`.","Fix permissions/ownership of the intended parent directory (chmod/chown or sudo).","If on a read-only mount, remount rw or pick another path."],"exampleFix":"# before\napktool if fw.apk --frame-path /usr/share/apktool/fw   # not writable\n# after\nmkdir -p ~/.local/share/apktool/fw\napktool if fw.apk --frame-path ~/.local/share/apktool/fw","handlingStrategy":"validation","validationCode":"File dir = new File(framePath);\nif (!dir.exists()) {\n    if (!dir.mkdirs()) throw new IllegalStateException(\"Cannot create framework dir: \" + dir\n        + \" (check write permission on \" + dir.getParentFile() + \")\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Point --frame-path into user-writable storage (~/.local/share/apktool).","Pre-create the directory in provisioning scripts to fail early with a clear error."],"tags":["apktool","framework","permissions","filesystem","config"],"backgroundTag":null,"analyzedSha":"79b63384d7d7e22917e6ea8b453272da7012515b","analyzedAt":"2026-08-14T10:43:28.812Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}