Android - How to make a project dependent on another

I'm super overwhelmed with a lot of information and my problem is pretty simple.

I made a project in IntelliJ Idea that has a package called com.example.util

. In this package, I have some static classes that I want to use in other projects.

Now I have an Android project and I want to use the classes in this utility.

However, I cannot find an easy way that allows me to preserve thread state while editing two projects (Android and Util). I can compile the util package into one JAR file and then copy it to a folder libs

on Android, but that works too much and is inefficient.

Can someone explain this to me? All I want is to keep writing in the Util package and the Android project to output all the classes.

+3


source to share


3 answers


Perhaps you can put the classes you want to use in the library: Create multiple projects in Android Studio

Here is a small snippet of the answer from the above post describing how to add your library to the project:



In the .gradle settings of the project add

include ':commonLibrary'
project(':commonLibrary').projectDir= new File('../path_to_your_library_module')

      

In build.gradle add

compile project(':commonLibrary').

      

+1


source


It's very simple. On your gradle construct, in the "dependecies" block, add the line:



compile project(":path:myproject")

      

0


source


Go to File, Click New - Import Module Add Loaded Project After import, right click on your project and select Open Module Settings In the Modules section, select your application, go to the dependencies tab, click + "and select" Module Dependency ". Done!

fooobar.com/questions/2423648 / ...

or

https://github.com/MagicMicky/FreemiumLibrary/wiki/Import-the-library-in-Android-Studio (follow method 2 to 7)

0


source







All Articles