android studio引入第三方包记录

 

1.添加jar文件

将jar文件复制至app module目录下的libs文件夹下,然后打开app module目录下的build.gradle配置文件,在dependencies项中添加配置命令,这里有

1 一次性引入libs目录下所有jar文件
2 compile fileTree(include: ['*.jar'], dir: 'libs')
3 
4 
5 单个逐一引入jar文件
6 compile files('libs/universal-image-loader-1.8.6-with-sources.jar')

 

2.通过配置添加第三方库

举例:引入ButterKnife第三方库

git:https://github.com/JakeWharton/butterknife

    1>在工程根目录下build.grade文件中添加apt

buildscript {
  repositories {
    mavenCentral()
   }
  dependencies {
    classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
  }
}

   2>在app目录下的build.grade 引入apt和butterknife配置

 1 apply plugin: 'android-apt'
 2 
 3 android {
 4   ...
 5 }
 6 
 7 dependencies {
 8   compile 'com.jakewharton:butterknife:8.4.0'
 9   apt 'com.jakewharton:butterknife-compiler:8.4.0'
10 }

 

posted @ 2016-09-02 10:40  木木小强  阅读(272)  评论(0编辑  收藏  举报