funkycookie
funkycookie

Reputation: 226

Importing a .jar into project structure

so I checked out this URL: svn checkout http://android-jhlabs.googlecode.com/svn/trunk/ that has some image filters I would like to use in my project. I made a jar file out of the checked out folder(libs folder, copy/paste the jar, add as library, etc...) However, I cannot access the java files from the inside, just the folder structures

EDIT: I use Android Studio :)

Upvotes: 0

Views: 311

Answers (4)

ovluca
ovluca

Reputation: 291

STEP 1: copy your jar in "libs" folder from your project.

STEP 2: open "app/build.gradle" and be sure you have this:

dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) }

STEP 3: click button "Sync Project with Gradle Files"

STEP 4: (optional) clean and build your project

Upvotes: 1

Bhagirathsinh Gohil
Bhagirathsinh Gohil

Reputation: 673

[ For Eclipse]

First of all add jar file into you project directory or libs/ directory.

Then Right click on project folder & go to Build Path -> Library -> Add JAR should allow you to pick the one out of your project.

Then go to Order & Export and put Android Private Libraries at top than press ok.

Now you can access your all java classes from jar file.

[For Android Studio]

First of all add jar file into you project directory or libs/ directory or copy & paste.

Than right click on jar file and select "Add as library".

Now you can access jar file classes.

Upvotes: 0

demir
demir

Reputation: 4709

  1. Add jar file into the libs folder
  2. Right click it(jar file) and hit 'Add as library'

That's all. https://stackoverflow.com/a/16628496/2190621

Upvotes: 1

FilippoDN
FilippoDN

Reputation: 1

If you use eclipse, putting the jar in the lib folder of your android project should be enough. The java files have to be added to the source tree, or you could make a separate library project containing the java files and the jar and make it a dependency if your main android project. Ok, saw the edit about using android studio, I have not used it enough (was not stable enough on linux) to give any useful advice, sorry.

Upvotes: 0

Related Questions