Purpose: Android library at single place - Share across multiple projects
Following are the steps:
1. Create new Android studio project. I have created one with name "Libraries"
2. Create one new module File->New->New Module
As shown in pic below, I have added one new module named "androidutils"
1. Create new Android studio project. I have created one with name "Libraries"
2. Create one new module File->New->New Module
As shown in pic below, I have added one new module named "androidutils"
We can create as many modules as we want. Each module will be like different library.
We can create as many modules as we want. Each module will be like different library.
3. Open the other project in Android Studio, where you want to use the library "androidutils"
Change the navigation view to "Project"
3. Open the other project in Android Studio, where you want to use the library "androidutils"
Change the navigation view to "Project"
Open settings.gradle and make it look like below and Sync the gradle
In above picture, we are telling gradle to include the module androidutils and also telling where to look for that module
After syncing gradle you would see your module in the navigator
But at this point, you wont be able to use it in your app.
Open your app's build.gradle. Highlighted one in below picture
and add following line in dependencies section and sync again
compile project(':androidutils')
Now you should be able to use your library in your project
Tip: Keep Libraries project open in separate instance of Android Studio
HIH
0 nhận xét:
Đăng nhận xét