0

I'm trying to add a jar file to my existing app. When I tried to the following absolute path to my build.gradle, it works fine.

compile files('C:/Users/julia/AndroidStudioProjects/TestProject/libs/MyPo.jar')

However, when I tried to change it to relative path, it doesn't work.

compile files('libs/MyPo.jar'), I also tried
compile project('libs:MyPo.jar')
compile project(':libs:MyPo.jar')

What's the proper way to add this jar file to my app using relative path? Thanks.

Julia
  • 1,207
  • 4
  • 29
  • 47
  • Here is the solution already in stackoverflow :. http://stackoverflow.com/q/16608135/3595514 – Rajendra Sep 02 '16 at 02:34
  • Yah I saw that answer, but couldn't understand the second part (Right click it and hit 'Add as library') I don't see the option Add as Library when I right click on the jar file in Android Studio. – Julia Sep 02 '16 at 16:06

2 Answers2

1

put jar file on app->lib folder and in your project build.gradle use compile ('libs/filename.jar') then sync your project this will work

Pallavi Jain
  • 5,319
  • 2
  • 11
  • 3
0

File->Project Structure->Dependencies->"+"->File dependency

Jude Niroshan
  • 4,280
  • 8
  • 40
  • 62