skip to Main Content

I am really new into this topic, I have a simple project that is an android studio template with some modifications, the project is a simple application with sidebar menu, the android studio uses fragments for this case, now I want to use a module from another project (https://github.com/yamin8000/Gauge) inside one of the fragments (Home) of the app, I imported the module and did some gradle changes so the project has two modules now, one is the default "app" module, and the second is the "Gauge" module from the source project, but I absolutely have no clue how to perform it, shall I import the module like this: "import (project(":Gauge"))" or what? can someone explain me in simple language so I can understand it, tnx

the project overall preview

2

Answers


  1. You have that import (project(:Gauge)) – it’s not gonna work this way. Here is what you should do:

    1. Go to your app’s build.gradle and put this string to dependencies block, if it is not already there:

    implementation project(:Gauge)

    1. Run Gradle sync

    Now, you can use classes and methods from Gauge module. Android Studio is smart enough and will provide you suggestions when you will start typing Gauge or something and will add needed imports automatically

    Login or Signup to reply.
  2. Step 1:
    Locate your module from another project in settings.gradle.kts:

    // below everything
    
    include ':library:webRtc'
    project(':library:webRtc').setProjectDir(new File(settingsDir, "../../Libraries/audiocall/webRtc"))
    

    Step 2: add this module as dependency in app/build.gradle.kts file:

    dependency {
        implementation(project(":library:webRTC"))
        // other dependenceis...
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search