Nig*_*ler 7 dependencies android gradle android-studio build.gradle
我试图将我的项目集成到android studio中.但是在添加依赖项时我很困惑.我不知道哪一个工作正常.我已经尝试编译fileTree并编译文件.它不适合我.我找到了一些方法.任何人都告诉我哪一个适合添加库(jar文件只有像admob一样).
compile fileTree(dir: 'libs', include: '*.jar')
compile 'com.android.support:appcompat-v7:+'
compile project(":libraries:libraryname")
compile files('libs/libraryname.jar')
Run Code Online (Sandbox Code Playgroud)
Com*_*are 12
任何人都可以告诉我哪一个适合添加库(jar文件只有像admob).
如果库可以作为Maven或Ivy存储库中的工件(如Maven Central)使用,则将存储库添加到repositories块(例如mavenCentral()),然后使用compile 'com.android.support:appcompat-v7:+',将带引号的字符串替换为标识所需工件的字符串.
如果库不可用作工件,请将JAR放在适当的目录中(例如,libs/在项目级别)并使用compile fileTree(dir: 'libs', include: '*.jar').
compile project(":libraries:libraryname") 适用于您可能没有的子项目.
compile files('libs/libraryname.jar')但是compile fileTree(dir: 'libs', include: '*.jar')更灵活,因为您不必build.gradle为每个JAR 更改文件.
| 归档时间: |
|
| 查看次数: |
2277 次 |
| 最近记录: |