1

Create two projects with new-project with Android Studio.

There are two blank projects created above.

I'll name them Project A and B. A refers to B. A can call a class of B.

If necessary, the two projects must be independently executable by app. From the beginning, A and B were each made with a new project command.

How can I do this?

The project will be copied, if using the method of adding modules in Project Structure below.

The two projects in Git exist separately. Each is an environment in which a separate developer develops.

I want the project to be only a reference without being copied

If you do the following, an error will occur:

https://www.geeksforgeeks.org/how-to-add-a-library-project-to-android-studio/

How to use a project in another project as a module?

[Project A -  settings.gradle]
rootProject.name = "ProjectA"

include (':app', ':projectB')

project(':projectB').projectDir = new File('D:/Development/Android/multiModuleTest/ProjectB')
dependencies {
    implementation project(':projectB')
    ....
    ....
}

[error]

Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.
   > Could not resolve project :projectB.
     Required by:
         project :app
      > No matching configuration of project :projectB was found. The consumer was configured to find an API of a component, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug', attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '7.4.1', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but:
          - None of the consumable configurations have attributes.
halfer
  • 19,824
  • 17
  • 99
  • 186
code beginner
  • 19
  • 1
  • 2

0 Answers0