Android Studio - Creating Modules without copying files?
Yes, you can do it. The module needs to have a Gradle build file set up for it. If it's got that, then in the project you're linking to it, add this to the settings.gradle file at the project root:
include ':libraryName'
project(':libraryName').projectDir=new File('/path/to/library')
where the path you specify in the second line is the path to the directory containing the library's build.gradle file. The path can be relative or absolute.
How to reference without copying a library project on Android Studio?
Got it:
In your project, go in settings.gradle and declare something like this:
include ':LibReferenceName'
project(':LibReferenceName').projectDir = new File(settingsDir, '../relativePath/toThe/libraryModule/fromTheProject')
And at the modules that requires the library, include something like this in the build.gradle of it:
compile project(path: ':LibReferenceName')
You can also not use settingsDir and just put the absolute path of the project.
How to import a library project in Android Studio, without making a copy?
The real answer to keep your library project only in one place is in this post :
Android Studio 0.8.1 Creating Modules without copying files?
How to create modules in a features(outer) module for Dynamic Features with Android Studio
Not sure about it can be done by Android Studio
but the simple way following these steps
- You create a
Module
as normal fromRigh Click
inapp
folder - Create
Directory
with namefeatures
, switch toProject
structure view and move yourModule Directory
tofeatures
- If you using
dynamic-feature-module
you have to change insettings.gradle
file andbuild.gradle
app.
How do I make an app use a module outside of its own folder, by linking to it (instead of copying)?
Yes you can!
Inside your settings.gradle
add:
include ':myModule'
project(':myModule').projectDir = new File('../../MyOtherProject/modules/myModule')
Related Topics
The Process of the Service Is Killed After the Application Is Removed from the Application Tray
Determining If an Android Device Is Rooted Programmatically
Android: Open Activity Without Save into the Stack
Configuration with Name 'Default' Not Found. Android Studio
Icon in Menu Not Showing in Android
Android: Test Push Notification Online (Google Cloud Messaging)
Creating Viewholders for Listviews with Different Item Layouts
How to Create an Android Library Jar with Gradle Without Publicly Revealing Source Code
Sending and Receiving Text Using Android Emulator
Android Webview Loading Data Performance Very Slow
How to Wrap the Height of a Viewpager to the Height of Its Current Fragment
Disable Default Animation from Portrait to Landscape
Inflateexception with Floatingactionbutton from Official Design Library
Libpng Error: Not a Png File Error Showing in Android Studio
How to Get Activity's Content View