Android Studio - Importing external Library/Jar Android Studio - Importing external Library/Jar android android

Android Studio - Importing external Library/Jar


So,

Steps to follow in order to import a JAR sucesfully to your project using Android Studio 0.1.1:

  • Download the library.jar file and copy it to your /libs/ folder inside your application project.
  • Open the build.gradle file and edit your dependencies to include the new .jar file:

compile files('libs/android-support-v4.jar', 'libs/GoogleAdMobAdsSdk-6.4.1.jar')

  • File -> Close Project
  • Open a command prompt on your project's root location, i.e 'C:\Users\Username\AndroidStudioProjects\MyApplicationProject\'
  • On the command prompt, type gradlew clean, wait till it's done.
  • Reopen your application project in Android Studio.
  • Test run your application and it should work succesfully.


You don't need to close the project and go to command line to invoke grade:clean.Go to Build-> Rebuild Project


Easy way and it works for me. Using Android Studio 0.8.2.

  1. Drag jar file under libs.
  2. Press "Sync Project with Gradle Files" button.

enter image description here