Вы находитесь на странице: 1из 3

Stack Overflow

Questions

Tags

Users

sign up
Badges

Unanswered

log in

Ask

Read this post in our app!

How to add any jar file in the Android studio? [duplicate]


19

android

android-studio

This question already has an answer here:


Android Studio: Add jar as library? 28 answers

I'm working the basic android application , I do not know where to add the jar file in the android studio.

share

improve this question


seenu s
714 1 3 21

Asked
Mar 23 '15 at 10:03

marked as duplicate by Fahim, TGMCians, kenorb, dandan78, Raidri Mar 23 '15 at 13:06
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

If that .jar file is any api you want to use in your project then copy it in yourProject/app/libs directory Apurva Mar 23 '15 at 10:05
i add the jar in the libs folder but it's not taking seenu s Mar 23 '15 at 10:06
also add compile fileTree(include: ['*.jar'], dir: 'libs') under dependencies {...} in gradle.build Apurva Mar 23 '15 at 10:09
Error:(7, 0) Gradle DSL method not found: 'compile()' Possible causes: The project 'App' may be using a version of Gradle that does not contain the method. Gradle

settings.The build file may be missing a Gradle plugin. seenu s Mar 23 '15 at 10:12

Post your gradle.build file Apurva Mar 23 '15 at 10:21

show 5 more comments

order by votes

2 Answers

29

You can add the jar file in the android studio as follows:
1. Add a folder in your project named "Libs" and keep the jar files inside this folder , which you want to use in your project.
2. You will be able to see the jar file from android studio. Right click on the jar file and select the option "Add as Library" and Click
Ok.

share

improve this answer


Prince
314 3 2

First you have to click the top drop-down menu "Android" and choose "Project" to see the folders. 40-Love Jan 2 at 18:59

add a comment

First copy the .jar file in yourproject/app/libs directory


Then open your gradle.build(Module:app) and copy compile fileTree(include: ['*.jar'], dir: 'libs') in dependencies{}

Answered
Mar 23 '15 at 10:12

apply plugin: 'com.android.application'


android {
compileSdkVersion 21
buildToolsVersion '21.1.2'
defaultConfig {
applicationId "com.android...."
minSdkVersion 9
....
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {

share

improve this answer


Apurva
3,621 3 14 37

Answered
Mar 23 '15 at 10:30

meta chat tour help blog privacy policy legal contact us full site
Download the Stack Exchange Android app
2016 Stack Exchange, Inc

Вам также может понравиться