MuntashirAkon/AppManager · error · FileNotFoundException

Class definition for + src.getFullPath() + is not found.

Error message

Class definition for + src.getFullPath() + is not found.

What it means

DexFileSystem.cacheFile writes a class's contents to a sink file. As with getInputStream, if the source Node's ClassDef is null the class definition cannot be resolved in the DEX and a FileNotFoundException naming the node's full path is thrown.

Source

Thrown at app/src/main/java/io/github/muntashirakon/io/fs/DexFileSystem.java:284

    @NonNull
    @Override
    protected InputStream getInputStream(@NonNull Node<?> node) throws IOException {
        ClassDef classDef = (ClassDef) node.getObject();
        if (classDef == null) {
            throw new FileNotFoundException("Class definition for " + node.getFullPath() + " is not found.");
        }
        try {
            return new ByteArrayInputStream(getDexClasses().getClassContents(classDef).getBytes(StandardCharsets.UTF_8));
        } catch (ClassNotFoundException e) {
            throw new IOException(e);
        }
    }

    @Override
    protected void cacheFile(@NonNull Node<?> src, @NonNull File sink) throws IOException {
        ClassDef classDef = (ClassDef) src.getObject();
        if (classDef == null) {
            throw new FileNotFoundException("Class definition for " + src.getFullPath() + " is not found.");
        }
        try (FileOutputStream os = new FileOutputStream(sink)) {
            os.write(getDexClasses().getClassContents(classDef).getBytes(StandardCharsets.UTF_8));
        } catch (ClassNotFoundException e) {
            throw new IOException(e);
        }
    }

    @NonNull
    private static Node<ClassDef> buildTree(@NonNull DexClasses dexClasses) {
        Node<ClassDef> rootNode = new Node<>(null, File.separator);
        List<String> classNames = dexClasses.getClassNames();
        for (String className : classNames) {
            ClassDef classDef;
            try {
                classDef = dexClasses.getClassDef(className);
            } catch (ClassNotFoundException e) {
                classDef = null;

View on GitHub (pinned to 0152f468fc)

Solutions

  1. Filter the node list to nodes with a non-null ClassDef before caching.
  2. Remount the DEX filesystem to rebuild nodes/ClassDefs for the current DEX.
  3. Catch FileNotFoundException per node and skip/report it instead of failing the whole export.
  4. Verify exact class path spelling (package separators map to path separators).

Example fix

// before
for (Path p : dexMount.listFiles()) p.copy(sinkDir);
// after
for (Path p : dexMount.listFiles()) {
    if (((Node<?>) p.getAttachment()).getObject() != null) p.copy(sinkDir);
}
Defensive patterns

Strategy: try-catch

Validate before calling

if (node.getObject() == null) { skip(node); return; }

Type guard

static boolean isClassNode(Node<?> n) { return n.getObject() instanceof ClassDef; }

Try / catch

try {
    vfs.cacheFile(node, sink);
} catch (FileNotFoundException e) {
    // log and continue with next node
}

Prevention

When it happens

Trigger: Copying/caching a DEX-VFS node to a real file when node.getObject() (ClassDef) is null — entry missing from the DEX, stale node after DEX change, or a non-class node.

Common situations: Batch-exporting all classes from a mounted DEX where some listed paths are not real class defs; exporting after the DEX file changed on disk; wrong class path casing.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


AI-assisted analysis of MuntashirAkon/AppManager@0152f468fc (2026-09-12). Data as JSON: /api/errors/fc66b0669b07ee29. Report an issue: GitHub.