Add JAR in Android Studio 1.0

I want to add an external library to an Android Studio 1.0 project. The rest of the answers on stackoverflow seem deprecated. At least I can not find the "lib" folder in my project and I do not know how to create it.

edit: As I pointed out, I mean the latest version of Android Studio. I assume that there are some differences between this version and the one in question. Shortcuts do not work, and my folder structure varies greatly. I created a new HelloWorld project to test it.

+6
source share
2 answers

In the module that wants to use the jar, create the lib folder and put your jar in it.

In the build.gradle module add this to the dependencies group:

 compile files('lib/my_jar.jar') 
+2
source

Create a directory called lib in the app directory. Then put your jar file. Then make sure the line is in the dependencies build.gradle section

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

Sometimes I just put the jar in the lib folder and right-click on it and select Add as library .

0
source

Source: https://habr.com/ru/post/979865/


All Articles