Skip to main content

Android Studio–Add local jar / library to project

Hi recently I want to add third party module to my project. However I want don’t to use that slow gradle to download it. I downloaded the required jars. Now I had to import it to my project.

I tried method #1
Right Click project –>New –> Module –> Import .JAR/.AAR project-> Select my library and finish. However this still didn’t work for me.



Method #2 
this worked !
image
  • Change my project view from “android” to “Project”
  • Create “libs” folder.
  • Copied my .jar to this folder.
  • Right click the added .JAR and select “Add Library”.
  • Check your build.gradle below lines will be present
  • compile files('libs/android-async-http-1.4.9.jar')

#Method 3

To add any imported library project to the current application. Open build.gradle and add line

compile project(path: ':projectname')

like:

dependencies {
 compile fileTree(dir: 'libs', include: ['*.jar'])
 compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.android.support:support-vector-drawable:23.4.0'
testCompile 'junit:junit:4.12'
compile project(path: ':projectname') 
}

Comments

Popular posts from this blog

Xamarin : Simple Calculator Tutorial Visual Studio C#

Simple Calculator in Android (Xamarin) using VisualStudio C#In Brief: This article will help you on building a simple calculator in android Xamarin with simple steps using C# Language in Visual Studio. Detail:
Building this simple calculator will let you learn how to work with the Android Buttons, Text View and simple functions. The UI is not so beautiful but is a great way to learn the basic functionalities.

Create Custom View in android MATRIX EFFECT CANVAS tutorial

Create Custom View in android MATRIX EFFECT CANVAS tutorial
Hi all as I stared my development with android I always wanted to create a Custom view or rather I want a canvas where I can draw freely. To learn about canvas I decided to create matrix rain effect which I can add to my android layout. Here is the complete tutorial which I have post. Hopping it will be use full to someone.

You can find the link to android project at the bottom of the post

Android Transparent status bar

Recently I wanted to get a transparent status bar so that my app background blends smoothly with the status bar . Below method worked