skylot/jadx · error · JadxRuntimeException

Unexpected export type: {}

Error message

Unexpected export type: {}

What it means

Thrown as JadxRuntimeException by ExportGradle.init() in the default branch of the switch on ExportGradleType. Under normal operation, getExportGradleType() resolves AUTO to a concrete type (ANDROID_APP, ANDROID_LIBRARY, or SIMPLE_JAVA) before the switch. Reaching the default branch means the enum returned a value not covered by the switch, indicating either a new ExportGradleType constant added without a case, or AUTO slipping through due to a logic regression.

Source

Thrown at jadx-core/src/main/java/jadx/core/export/ExportGradle.java:44

	public ExportGradle(RootNode root, File projectDir, List<ResourceFile> resources) {
		this.root = root;
		this.projectDir = projectDir;
		this.resources = resources;
	}

	public OutDirs init() {
		ExportGradleType exportType = getExportGradleType();
		LOG.info("Export Gradle project using '{}' template", exportType);
		switch (exportType) {
			case ANDROID_APP:
			case ANDROID_LIBRARY:
				generator = new AndroidGradleGenerator(root, projectDir, resources, exportType);
				break;
			case SIMPLE_JAVA:
				generator = new SimpleJavaGradleGenerator(root, projectDir, resources);
				break;
			default:
				throw new JadxRuntimeException("Unexpected export type: " + exportType);
		}
		generator.init();
		OutDirs outDirs = generator.getOutDirs();
		outDirs.makeDirs();
		return outDirs;
	}

	private ExportGradleType getExportGradleType() {
		ExportGradleType argsExportType = root.getArgs().getExportGradleType();
		ExportGradleType detectedType = detectExportType(root, resources);
		if (argsExportType == null
				|| argsExportType == ExportGradleType.AUTO
				|| argsExportType == detectedType) {
			return detectedType;
		}
		return argsExportType;
	}

View on GitHub (pinned to e738a26571)

Solutions

  1. If using a stock jadx release, report this as a bug — AUTO should be resolved before the switch.
  2. If using a patched build, ensure every non-AUTO ExportGradleType constant has a case in the switch.
  3. Check the --export-gradle-type argument value; if you passed an unexpected value, remove it to let jadx auto-detect.
Defensive patterns

Strategy: validation

Validate before calling

// Validate the export type is one of the handled values
ExportGradleType type = root.getArgs().getExportGradleType();
if (type != null && type != ExportGradleType.AUTO
        && type != ExportGradleType.ANDROID_APP
        && type != ExportGradleType.ANDROID_LIBRARY
        && type != ExportGradleType.SIMPLE_JAVA) {
    throw new IllegalArgumentException("Unsupported export gradle type: " + type);
}

Prevention

When it happens

Trigger: A new ExportGradleType enum constant is added but not handled in the switch. Alternatively, getExportGradleType() returns AUTO due to a bug in the resolution logic (the method should never return AUTO). User-specified export types via CLI args (--export-gradle-type) are checked against detected types; a future or custom enum value would trigger this.

Common situations: Using a custom or patched jadx build with an ExportGradleType enum that has unhandled values. Essentially unreachable in stock jadx releases unless a regression is introduced.

Related errors


AI-assisted analysis of skylot/jadx@e738a26571 (2026-08-14). Data as JSON: /api/errors/fd1b51216e8472fa. Report an issue: GitHub.