Adding a dependency to Android project for jar

238 Views Asked by At

I'm attempting to integrate Localytics into my Android project. Their steps for integration include:

Add a dependency to your project for the jar.

How do I do that?

4

There are 4 best solutions below

0
On

using gradle :

repositories {
       flatDir {
           dirs 'libs'
       }
    }


    dependencies {
       compile name: 'gson-2.2.4'
    }
0
On
  1. Put your .jar file in your libs folder.

PROJECT_NAME/app/libs/example.jar

  1. Add the .jar file to your dependencies in the gradle file.

    dependencies {
        compile files('libs/example.jar')
    }
    
0
On

If you are using Android studio, switch to "Project" view, locate the Jar(s) you want to add as dependency. Right click on the Jars and select "Add as Library".

PS: To open the "Project" view. Use the menu View > Tool Windows > Project

0
On
  1. Copy the Localytics jar into your app/libs folder.
  2. Right click on the Localytics.jar file and select "Add as Library" from the conntext menu
  3. Finally make sure that you see the folling in app/build.gradle

    dependencies { compile files('libs/localytics.jar') }