How can I import an external module (named ViewPagerIndicator) in Android Studio?
            Asked
            
        
        
            Active
            
        
            Viewed 1.2e+01k times
        
    50
            
            
        - 
                    1Follow : http://stackoverflow.com/questions/21130003/using-viewpagerindicator-library-with-android-studio-and-gradle – ZaptechDev Kumar Jan 20 '17 at 13:06
 - 
                    Possible duplicate of [Using ViewPagerIndicator library with Android Studio and Gradle](http://stackoverflow.com/questions/21130003/using-viewpagerindicator-library-with-android-studio-and-gradle) – samiles Jan 20 '17 at 15:00
 
7 Answers
108
            Steps to import Module in Android Studio 3.3 and lower.
- Go to File >> New >> Import Module...
 - Select the source directory of the Module you want to import and click Finish.
 - Open Project Structure and open Module Settings for your project.
 - Open the Dependencies tab.
 - Click the (+) icon and select Module Dependency. Select the module and click Ok.
 - Open your 
build.gradlefile and check that the module is now listed under dependencies.implementation project(path: ':ViewPagerIndicator') 
Steps to import Module in Android Studio 3.4 and higher (See attached image).
- Go to File >> New >> Import Module...
 - Select the source directory of the Module you want to import and click Finish.
 - Open Project Structure Dialog (You can open the PSD by selecting File > Project Structure) and from the left panel click on Dependencies.
 - Select the module from the Module(Middle) section In which you want to add module dependency.
 - Click the (+) icon from the Declared Dependencies section and click Module Dependency.
 - Select the module and click Ok.
 - Open your 
build.gradlefile and check that the module is now listed under dependencies.implementation project(path: ':ViewPagerIndicator')
 
        steveluscher
        
- 4,144
 - 24
 - 42
 
        Aman Shekhar
        
- 2,719
 - 1
 - 18
 - 29
 
- 
                    7file>>>NEW>>>>import... That NEW is so important in latest version – Lakhwinder Singh Dhillon Oct 29 '17 at 13:58
 - 
                    @Shekhar Sir can you take a look at this question https://stackoverflow.com/questions/57779798/add-module-dependency-for-imported-module-shows-blank-screen thank you for your time. – peco Sep 04 '19 at 10:27
 - 
                    1I am unable to find Module Dependency in the dropdown. Only Library dependency and JAR dependency are available. What should I do? (Android Studio 4.1.2) – Abdullah Javed Mar 11 '21 at 14:57
 - 
                    It doesn't work. If I go to File > New > Import Module, it wants me to import an entire project, but I just need to import one Java file. – Donald Duck Aug 09 '21 at 12:28
 - 
                    @DonaldDuck, what is your question. If you want to import just one java file, then just do copy paste. The above procedure I wrote is to "Import a Module". – Aman Shekhar Aug 10 '21 at 13:25
 
10
            
            
        - Click on 
Fileand selectImport Module option. - Open of select your 
ViewPagerIndicatormodule from local. - add 
compile project(path: ':ViewPagerIndicator')in your gradle file. 
        Sushin Pv
        
- 1,826
 - 3
 - 22
 - 36
 
        Mehul Kabaria
        
- 6,404
 - 4
 - 25
 - 50
 
- 
                    Error:Dependency DialoFragmentdemo:app:unspecified on project ViewPagerIndicator-Library resolves to an APK archive which is not supported as a compilation dependency. File: C:\Users\Saurabhk\DialoFragmentdemo\app\build\outputs\apk\app-release-unsigned.apk – user3395396 Jan 23 '17 at 07:38
 - 
                    @Mehul Kabaria Sir can you take a look at this question https://stackoverflow.com/questions/57779798/add-module-dependency-for-imported-module-shows-blank-screen thank you for your time. – peco Sep 04 '19 at 10:27
 
10
            
            
        To import an existing Java library to an android project. Do the following.
Then select your Java library.
        Siddarth Kanted
        
- 5,738
 - 1
 - 29
 - 20
 
4
            
            
        I was also facing the same issue. Please make sure below steps
1)build.gradle :-
     implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(path: ':<Project-name>')
2) settings.gradle
     include ':<Project-name>'
        sharma_kunal
        
- 2,152
 - 1
 - 28
 - 28
 
3
            
            
        This tutorial will help you to do easily that without any code in build.gradle (actually system will do code for you).
        Gk Mohammad Emon
        
- 6,084
 - 3
 - 42
 - 42
 
3
            
            
        In case you have a module in your android project called library for example, and you want to add this module as a library to another module called app for example, in that same android project, here's what just worked for me, add this inside your app module's build.gradle:
dependencies {
    implementation project(path: ':library')
}
        Kevin Germain
        
- 471
 - 3
 - 6
 
0
            
            
        - Go to File > New > Project Structure
 - In the left you see Dependencies, click on it
 - All Modules need to be chosen
 - Click + and Library Dependency
 - Search module that you need
 
        Владислав Блоцкий
        
- 166
 - 1
 - 3
 
