天天看點

android studio 使用libs包

Step to add external library in Android Studio

  1. If you are in Android View in project explorer, change it to Project view as below
android studio 使用libs包
  1. Right click the desired module where you would like to add the external library, then selectNew > Directroy and name it as 'libs'
  2. Now copy the blah_blah.jar into the 'libs' folder
  3. Right click the blah_blah.jar, Then select 'Add as Library..'. This will automatically add and entry in build.gradle as compile files('libs/blah_blah.jar') and sync the gradle. And you are done

Please Note : If you are using 3rd party libraries then it is better to use transitive dependencies where Gradle script automatically downloads the JAR and the dependency JAR when gradle script run.

Ex : compile 'com.google.android.gms:play-services-ads:9.4.0'

Read more about Gradle Dependency Mangement

原文

繼續閱讀