Android Studio: “new module -> import existing project” vs. “import module” Android Studio: “new module -> import existing project” vs. “import module” android android

Android Studio: “new module -> import existing project” vs. “import module”


You can add the three modules to the same project by creating a settings.gradle file in the MyProject/ folder and adding the modules to it:

include ':MyGradleModule'include ':MyPreGradleModule'include ':MyRawModule'

Then for each module, configure the build.gradle dependencies to reference the other modules as needed. For example, add this to the MyProjectMainModule to make it use the output produced by MyGradleModule:

dependencies {  compile project(':MyGradleModule')}

Finally, if your project has heterogeneous submodules then you can configure their structure using the 'sourceSets' closure. For example, your raw module would have a configuration similar to this:

android {    sourceSets {        main {            manifest.srcFile 'AndroidManifest.xml'            java.srcDirs = ['src']            resources.srcDirs = ['src']            aidl.srcDirs = ['src']            renderscript.srcDirs = ['src']            res.srcDirs = ['res']            assets.srcDirs = ['assets']        }        androidTest.setRoot('tests')    }}

Check out this section of the Gradle Plugin Guide to see what configuration options are available.


This worked out for me:

  1. Open your project in Android Studio
  2. Download the library (using Git, or a zip archive to unzip)
  3. Go to File > Import Module and import the library as a module
  4. Go to File > Project Structure > Modules
  5. Locate your main project module, click on it. It should have a fewandroid libraries, such as: support-v4, etc.
  6. Click on the more on the left green "+" button > Module dependency
  7. Select "your Library"


enter image description hereFor Adding Module into Android Studio

  1. File>>New>>Import Module>>select module, click on finish

  2. Goto settings.gradle file and add the module name as below separated by comma i.e. include ':app', ':payUMoneysdk'

  3. Now module is added in the project see in the app root folder.

  4. Goto project setting and click on dependencies click on the plus (+) symbol and choose the module, click on ok.

  5. The following module is added in the build.gradle with name implementation project(':payUMoneysdk')

Here i am sharing the image for your reference...i added PayUmoney and Mobilehelpsdk modules in my project its working properly..