iBotPeaches/Apktool · error · AndrolibException

Framework path is not a directory:

Error message

Framework path is not a directory: 

What it means

AndrolibException from Framework.getDirectory() when the configured framework path exists but is not a directory (it is a regular file). The framework directory (default 1.apk, 2.apk... storage) is resolved lazily on first framework use; a file squatting on that path makes storing framework APKs impossible, so apktool aborts rather than overwrite it.

Source

Thrown at brut.apktool/apktool-lib/src/main/java/brut/androlib/res/Framework.java:147

        for (Pair<Long, Integer> pair : parser.getEntrySpecFlagsOffsets()) {
            int position = pair.getLeft().intValue();
            int count = pair.getRight();
            for (int i = 0; i < count; i++, position += 4) {
                int flags = buffer.getInt(position);
                buffer.putInt(position, flags | 0x40000000); // ResTable_typeSpec::SPEC_PUBLIC
            }
        }

        return table;
    }

    public File getDirectory() throws AndrolibException {
        if (mDirectory == null) {
            String path = mConfig.getFrameworkDirectory();
            File dir = (path != null && !path.isEmpty()) ? new File(path) : DEFAULT_DIRECTORY;

            if (dir.exists() && !dir.isDirectory()) {
                throw new AndrolibException("Framework path is not a directory: " + dir);
            }

            File parent = dir.getParentFile();
            if (parent != null && parent.exists() && !parent.isDirectory()) {
                throw new AndrolibException("Framework path's parent is not a directory: " + parent);
            }

            if (!dir.exists() && !dir.mkdirs()) {
                throw new AndrolibException("Could not create framework directory: " + dir);
            }

            mDirectory = dir;
        }

        return mDirectory;
    }

    public File getApkFile(int id) throws AndrolibException {

View on GitHub (pinned to 79b63384d7)

Solutions

  1. Remove or rename the file at that path: `rm <path>` (after confirming it is not needed).
  2. Point --frame-path at a real (or not-yet-existing) directory.
  3. Check the path: `ls -ld <path>` should show 'd' or 'No such file'.

Example fix

# before
apktool if fw.apk --frame-path ./fw   # ./fw is a file
# after
rm ./fw
apktool if fw.apk --frame-path ./fw
Defensive patterns

Strategy: validation

Validate before calling

File dir = new File(framePath);
if (dir.exists() && !dir.isDirectory()) {
    throw new IllegalStateException("Framework path occupied by a file: " + dir);
}

Prevention

When it happens

Trigger: Setting a framework path (-p / --frame-path or Config.setFrameworkDirectory) that points at an existing file; creating a file named exactly like the intended framework dir; default location occupied by a file.

Common situations: Typos such as `--frame-path ~/apktool-framework` where that name is an existing file; scripts that touch a lockfile with the same name as the directory; a previous failed run leaving a file instead of a dir.

Related errors


AI-assisted analysis of iBotPeaches/Apktool@79b63384d7 (2026-08-14). Data as JSON: /api/errors/3ab886718261d228. Report an issue: GitHub.