Coding⏱️ 3 min read📅 2026-06-04

How to Fix: ERROR : error.NonExistentClass Kotlin In multi module Dagger project

Dagger 2 and Kotlin multi-module project error fix

Quick Answer: Use the @Module annotation in the lib module to make the Presenter class available for injection, and ensure that the app module includes the lib module as a dependency.

ERROR : error.NonExistentClass Kotlin In multi module Dagger project

This error occurs when you're trying to inject an object from another module in your Android multi-module project using Dagger 2. It can be frustrating when it happens, especially if you're working with a large project and have multiple modules that depend on each other.

🛑 Root Causes of the Error

  • The primary reason for this error is that Dagger 2 doesn't know about the class you're trying to inject from another module. This can happen due to several reasons such as missing dependencies, incorrect module configuration or a typo in the class name.
  • Another possible cause is that the class you're trying to inject is not annotated with `@Component` or `@Module`, which are required for Dagger 2 to recognize it.

✅ Best Solutions to Fix It

Resolving the issue by reconfiguring your modules

  1. Step 1: Step 1: Check your module configuration and ensure that all dependencies are correctly set up. Make sure that each module has its own `build.gradle` file and that the dependencies are declared in the correct order.
  2. Step 2: Step 2: Verify that the class you're trying to inject is annotated with `@Component` or `@Module`. If it's not, add the necessary annotations to your component declaration.
  3. Step 3: Step 3: Use Dagger 2's built-in features such as `@Provides` and `@Singleton` to define how dependencies should be provided. This can help resolve any issues related to dependency injection.

Alternative fix method

  1. Step 1: Step 1: Check if the class you're trying to inject is actually present in the module you're trying to inject from. Make sure that the class is correctly defined and not missing any dependencies.
  2. Step 2: Step 2: Use a tool like `kapt` to generate the necessary annotations for your classes. This can help resolve issues related to annotation processing.

🎯 Final Words

By following these steps, you should be able to resolve the ERROR : error.NonExistentClass Kotlin In multi module Dagger project issue in your Android multi-module project using Dagger 2. Remember to always double-check your module configuration and class annotations to ensure that everything is correctly set up.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions