一般只要在build.gradle中标签dependencies添加开源库,如下

dependencies {
   debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3.1' // or 1.4-beta1
   releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3.1' // or 1.4-beta1
   testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3.1' // or 1.4-beta1
 }

但是需要注意的是,应用中引用的仓库,如jcenter和mavenCentral,有的开源库只在其中有,如果编译通不过,可以在这两个仓库切换试试

mavenCenter和JCenter的区别

http://blog.sina.com.cn/s/blog_72ef7bea0102vvqg.html

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐