iBotPeaches/Apktool · error · AndrolibException

Framework path's parent is not a directory:

Error message

Framework path's parent is not a directory: 

What it means

AndrolibException from Framework.getDirectory() when the parent of the configured framework path exists but is not a directory. Because the framework dir may need to be created with mkdirs(), apktool first validates that the parent chain is sane; a regular file where a parent directory should be (e.g. /path/to/file/subdir where 'file' is a file) makes creation impossible and aborts with the offending parent path.

Source

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

                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 {
        return getApkFile(id, mConfig.getFrameworkTag());
    }

    public File getApkFile(int id, String tag) throws AndrolibException {
        File dir = getDirectory();

View on GitHub (pinned to 79b63384d7)

Solutions

  1. Inspect the parent path with `ls -ld <parent>` and remove/rename the offending file.
  2. Choose a framework path whose ancestors are all directories (or nonexistent).
  3. Fix setup scripts to mkdir -p the full framework path before running apktool.

Example fix

# before
--frame-path /opt/tools/frame   # /opt/tools is a file
# after
mv /opt/tools /opt/tools.bak && mkdir -p /opt/tools/frame
--frame-path /opt/tools/frame
Defensive patterns

Strategy: validation

Validate before calling

File dir = new File(framePath).getAbsoluteFile();
for (File p = dir.getParentFile(); p != null; p = p.getParentFile()) {
    if (p.exists() && !p.isDirectory()) {
        throw new IllegalStateException("Ancestor is a file: " + p);
    }
}

Prevention

When it happens

Trigger: Configuring --frame-path /a/b/c when /a/b is an existing regular file; deep framework paths where an intermediate component collides with a filename.

Common situations: Nested paths like --frame-path ~/tools where tools is a tarball or script; misordered setup scripts that create files before directories; typos where a path component was meant to be a directory.

Related errors


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