alibaba/ARouter · error · RuntimeException
ARouter::Compiler >>> No module name, for more information,
Error message
ARouter::Compiler >>> No module name, for more information, look at gradle log.
What it means
Thrown in BaseProcessor.init when the APT option AROUTER_MODULE_NAME (or fallback AROUTER_GENERATE_DOC_NAME-style option) is empty. ARouter's compiler needs a per-module name to namespace generated group/index classes; without it compilation fails with this RuntimeException. The gradle plugin normally injects this option automatically.
Source
Thrown at arouter-compiler/src/main/java/com/alibaba/android/arouter/compiler/processor/BaseProcessor.java:64
types = processingEnv.getTypeUtils();
elementUtils = processingEnv.getElementUtils();
typeUtils = new TypeUtils(types, elementUtils);
logger = new Logger(processingEnv.getMessager());
// Attempt to get user configuration [moduleName]
Map<String, String> options = processingEnv.getOptions();
if (MapUtils.isNotEmpty(options)) {
moduleName = options.get(KEY_MODULE_NAME);
generateDoc = VALUE_ENABLE.equals(options.get(KEY_GENERATE_DOC_NAME));
}
if (StringUtils.isNotEmpty(moduleName)) {
moduleName = moduleName.replaceAll("[^0-9a-zA-Z_]+", "");
logger.info("The user has configuration the module name, it was [" + moduleName + "]");
} else {
logger.error(NO_MODULE_NAME_TIPS);
throw new RuntimeException("ARouter::Compiler >>> No module name, for more information, look at gradle log.");
}
}
@Override
public SourceVersion getSupportedSourceVersion() {
return SourceVersion.latestSupported();
}
@Override
public Set<String> getSupportedOptions() {
return new HashSet<String>() {{
this.add(KEY_MODULE_NAME);
this.add(KEY_GENERATE_DOC_NAME);
}};
}
/**
* Resolve a type that may not be present on the consuming module's classpath.View on GitHub (pinned to 84f451d244)
Solutions
- Apply `apply plugin: 'com.alibaba.arouter'` in the module's build.gradle so the plugin supplies AROUTER_MODULE_NAME.
- Or set it manually: kapt { arguments { arg("AROUTER_MODULE_NAME", project.getName()) } } (or javaCompileOptions.annotationProcessorOptions.arguments for non-kapt).
- Check `gradle log`/stack trace as the message suggests to confirm which processor invocation lacked the option.
Example fix
// before (build.gradle)
apply plugin: 'com.android.application'
// after
apply plugin: 'com.android.application'
apply plugin: 'com.alibaba.arouter'
kapt {
arguments { arg("AROUTER_MODULE_NAME", project.getName()) }
} Defensive patterns
Strategy: validation
Validate before calling
// in build.gradle, verify before compilation
def hasArouterPlugin = plugins.hasPlugin('com.alibaba.arouter')
def moduleName = hasArouterPlugin ? project.getName() : null
if (moduleName == null) {
throw new GradleException("Set AROUTER_MODULE_NAME: apply plugin 'com.alibaba.arouter' or pass kapt arg")
} Prevention
- Always apply the com.alibaba.arouter gradle plugin in modules using ARouter.
- Explicitly set kapt arg AROUTER_MODULE_NAME in each module's build.gradle.
- Check that IDE/CI builds run the same Gradle configuration as the command line.
When it happens
Trigger: Running annotation processing (javac/kapt) on a module without the AROUTER_MODULE_NAME apt option set; applying ARouter without the `apply plugin: 'com.alibaba.arouter'` gradle plugin; processing triggered from an IDE build that skips the plugin's configuration step.
Common situations: Adding arouter-compiler to kapt without the ARouter gradle plugin; building a new module; running annotation processing in a non-Gradle build (Bazel, plain javac) where the option was never passed.
Understand the failure class
Background: "X is required", "must be set", "cannot be empty": the missing-required-config error family, from Vertex AI project/location to WeChat keys — this error's family across 18 libraries.
Related errors
- The fields need autowired from intent, its parent must be ac
- Unsupported primitive type: <type>
- The inject fields CAN NOT BE 'private'!!! please check field
- More than one interceptors use same priority [%d], They are
- The @Route is marked on unsupported class, look at [<type>].
AI-assisted analysis of alibaba/ARouter@84f451d244 (2026-09-06).
Data as JSON: /api/errors/f0ba5756b2b6a0b3.
Report an issue: GitHub.