{"record":{"id":"fd1b51216e8472fa","repo":"skylot/jadx","slug":"unexpected-export-type","errorCode":null,"errorMessage":"Unexpected export type: {}","messagePattern":"Unexpected export type: (.+?)","errorType":"exception","errorClass":"JadxRuntimeException","httpStatus":null,"severity":"error","filePath":"jadx-core/src/main/java/jadx/core/export/ExportGradle.java","lineNumber":44,"sourceCode":"\tpublic ExportGradle(RootNode root, File projectDir, List<ResourceFile> resources) {\n\t\tthis.root = root;\n\t\tthis.projectDir = projectDir;\n\t\tthis.resources = resources;\n\t}\n\n\tpublic OutDirs init() {\n\t\tExportGradleType exportType = getExportGradleType();\n\t\tLOG.info(\"Export Gradle project using '{}' template\", exportType);\n\t\tswitch (exportType) {\n\t\t\tcase ANDROID_APP:\n\t\t\tcase ANDROID_LIBRARY:\n\t\t\t\tgenerator = new AndroidGradleGenerator(root, projectDir, resources, exportType);\n\t\t\t\tbreak;\n\t\t\tcase SIMPLE_JAVA:\n\t\t\t\tgenerator = new SimpleJavaGradleGenerator(root, projectDir, resources);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow new JadxRuntimeException(\"Unexpected export type: \" + exportType);\n\t\t}\n\t\tgenerator.init();\n\t\tOutDirs outDirs = generator.getOutDirs();\n\t\toutDirs.makeDirs();\n\t\treturn outDirs;\n\t}\n\n\tprivate ExportGradleType getExportGradleType() {\n\t\tExportGradleType argsExportType = root.getArgs().getExportGradleType();\n\t\tExportGradleType detectedType = detectExportType(root, resources);\n\t\tif (argsExportType == null\n\t\t\t\t|| argsExportType == ExportGradleType.AUTO\n\t\t\t\t|| argsExportType == detectedType) {\n\t\t\treturn detectedType;\n\t\t}\n\t\treturn argsExportType;\n\t}\n","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/skylot/jadx/blob/e738a26571d02919f01df40de93bc9a44dee4e18/jadx-core/src/main/java/jadx/core/export/ExportGradle.java#L26-L62","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["If using a stock jadx release, report this as a bug — AUTO should be resolved before the switch.","If using a patched build, ensure every non-AUTO ExportGradleType constant has a case in the switch.","Check the --export-gradle-type argument value; if you passed an unexpected value, remove it to let jadx auto-detect."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Validate the export type is one of the handled values\nExportGradleType type = root.getArgs().getExportGradleType();\nif (type != null && type != ExportGradleType.AUTO\n        && type != ExportGradleType.ANDROID_APP\n        && type != ExportGradleType.ANDROID_LIBRARY\n        && type != ExportGradleType.SIMPLE_JAVA) {\n    throw new IllegalArgumentException(\"Unsupported export gradle type: \" + type);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Do not pass unsupported ExportGradleType values via --export-gradle-type.","Let jadx auto-detect by not specifying the type (or using AUTO).","If developing jadx, add a case for every non-AUTO ExportGradleType constant in the switch."],"tags":["jadx","gradle-export","switch-default","enum","unreachable"],"backgroundTag":null,"analyzedSha":"e738a26571d02919f01df40de93bc9a44dee4e18","analyzedAt":"2026-08-14T00:10:24.238Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}