Importing Module in Android Studio
How can I import an external module (named ViewPagerIndicator) in Android Studio?
Solution 1:
Steps to import Module in Android Studio 3.3 and lower.
- Go to Fill >> 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.gradle
file 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.gradle
file and check that the module is now listed under dependencies.implementation project(path: ':ViewPagerIndicator')
Solution 2:
To import an existing Java library to an android project. Do the following.
Then select your Java library.
Solution 3:
- Click on
File
and selectImport Module option
. - Open of select your
ViewPagerIndicator
module from local. - add
compile project(path: ':ViewPagerIndicator')
in your gradle file.
Solution 4:
This tutorial will help you to do easily that without any code in build.gradle
(actually system will do code for you).
Solution 5:
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>'