D
D
deelpro2020-08-17 11:56:46
android studio
deelpro, 2020-08-17 11:56:46

How to refer to the class of another module?

Good afternoon, colleagues!
I want to move the utility class into a separate module.
What I did for this:
1. File > new > New Module > Android Library > gave the name "Utils" and clicked finish
After that, the module appeared in the application. It has its own package structure.
2. Created a CustomTabs class in "Project\Utils\src\main\java\com\example\utils" (the path was created automatically)
3. Checked in setting.gradle it says "project(':utils').projectDir = new File ('modules/utils')"
4. Then I tried to refer to it, but nothing happened, I read somewhere that I still need to register the dependency in build.gradle > I wrote "kapt project(':Utils')", but still nothing works.

Tell me, how can I refer to this new class in the new module from the main application module? What is needed for this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Vodakov, 2020-08-17
@deelpro

In the build.gradle of the dependent module, write:

dependencies {
    ...
    implementation project(":utils")
    ...
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question