I want to import a android studio project into another android studio project. so i have imported it as module in the android studio project. this message project already have module that are used in the project. i have imported message project in android studio successfully. but when i adding a dependency it is not showing this module, so please check image that i have imported and how can i add dependency of message module.
I have tried
implementation project(':message')
But getting a error
ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve project :message. Show Details Affected Modules: app
ERROR: Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve project :message.
Show Details Affected Modules: app
ERROR: Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve project :message. Show Details Affected Modules: app
You should have a structure like this:
-rootApp
|--build.gradle
|--settings.gradle
|--app
|----build.gradle
-rootMessage
|--build.gradle
|--settings.gradle
|--vcard
|----build.gradle
Inside a project you can refer an external module.
Just use:
In rootApp/settings.gradle
:
include ':app'
include ':myExternalLib'
project(':myExternalLib').projectDir=new File('/path-to-project/rootMessage/vcard')
In app/build.gradle
:
dependencies {
implementation project(':myExternalLib')
}
Pay attention to myExternalLib.
You have to use the path of the library inside the other project, not the root of the project.
In your case the path is rootMessage/vcard
.
Also,the rootMessage/settings.gradle
will not be read because you are using the rootApp project.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With