4

There is a lib

https://github.com/Yalantis/uCrop

There are 2 modules Sample and ucrop - where all the logic is situated

Problem is - when I am copying the ucrop module to my project also added this

dependencies {
...
 implementation project(':ucrop')
....
}

and this

settings.gradle include ':ucrop', ':app'

As far as I know I need add only this lines to include new module to the project

Then I am trying to compile the app and get such error

Resolving this BuildableArtifact can only done during task execution.

The module 'ucrop' is an Android project without build variants, and cannot be built. Please fix the module's configuration in the build.gradle file and sync the project again.

What is the reason that my project doesn't want include new module?

Feel free ti ask

Thanks

4
  • Have you removed apply from: '../mavenpush.gradle' from ucrop build.gradle file? If not, Remove and try again. Dec 26, 2018 at 12:27
  • @DhavalPatel I did not removed it, because I also added this file to my project... So, it should works..
    – Sirop4ik
    Dec 26, 2018 at 12:31
  • Then make sure to copy content from github.com/Yalantis/uCrop/blob/master/build.gradle file as well. Dec 26, 2018 at 12:32
  • @DhavalPatel of course it is included in the ucrop module. So if I am copying module I also copying his gradle files
    – Sirop4ik
    Dec 26, 2018 at 12:38

3 Answers 3

5

Clone the repository which you want to be included as a module.

Provide the path of your cloned repository. Now suppose if I want to include Calendar module to my project.

1.Now go into android studio Click File->New->Import module.

2.Add this line to app's build.gradle

implementation project(':calender')

3.Add this line to settings.gradle.

include ':calendar'

Edit : Also you need to modify module's build.gradle file.Under build types you need to add this line

flavorDimensions "default"
4
  • But I don't need all the repository, I need just a module from that repository... What do you think?
    – Sirop4ik
    Dec 26, 2018 at 12:34
  • as i can see in the corp module, configuration is not defined for debug, include the debug type also and add flavor dimension to default Dec 26, 2018 at 12:42
  • Did you try to do so?
    – Sirop4ik
    Dec 26, 2018 at 13:24
  • I tried that in my project when I was facing a similar kind of issue. And it resolved that error. Dec 26, 2018 at 16:23
2

Steps to Import Module in Android Studio.

1) Go to File -> NEW-> Import Module...

2) Select the source directory of the Module you want to import and click Finish.

3) Open Project Structure and open newly import Module for your project.

4) Open the Dependencies tab.

5) Click the (+) icon and select Module Dependency. Select the module and click Ok. (if not found Module Dependency then try below way)

6) Open your build.gradle file and check that the module is now listed under dependencies.

-----> Second Way

1) Go to File -> NEW-> Import Module...

2) Select the source directory of the Module you want to import and click Finish.

3) Open settings.gradle of your project, you find newly added module name there, copied that.

4) Open build.gradle file and import module by below dependency

Ex. (if your module name is ClientLibrary)

    implementation project(path: ':ClientLibrary')

5) sync gradle. that all.

1
  1. In Android Studio, Right click on the app choose New -> Module
  2. Select import .AAR package which need to be incuded and provide the path for in the file name 3 .Right click on your App and choose Open Module Settings
  3. Open App in module setting and click on add button to add module dependency
  4. choose the module to be included .
  5. You can confirm the Module import by changing the Android view to Project view in thesidebar

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.