[英]How to add a third party library to android studio project from github?
I want to use this library in my project. 我想在我的项目中使用这个库。
Github - AndroidCountryPicker Github-AndroidCountryPicker
for other git libraries i always found the build gradle statement provided to be added to the project, here it is not. 对于其他git库,我总是发现提供的build gradle语句可以添加到项目中,但事实并非如此。 Can anyone help me?
谁能帮我? like these dependencies which i add to the project.
像我添加到项目中的这些依赖项。
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.1.1'
compile 'com.github.siyamed:android-shape-imageview:0.9.+@aar'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.daimajia.easing:library:1.0.1@aar'
compile 'com.github.clans:fab:1.4.0'
compile 'com.daimajia.androidanimations:library:1.1.3@aar'
compile 'com.astuetz:pagerslidingtabstrip:1.0.1'
compile 'it.neokree:MaterialTabs:0.11'
compile 'it.sephiroth.android.library.floatingmenu:floatingmenu:1.0.1'
compile 'com.github.castorflex.verticalviewpager:library:19.0.1'
compile 'com.oguzdev:CircularFloatingActionMenu:1.0.2'
compile 'com.kbeanie:image-chooser-library:1.4.3@aar'
compile 'org.jraf:android-switch-backport:1.4.0@aar'
compile('com.doomonafireball.betterpickers:library:1.5.5') {
exclude group: 'com.android.support', module: 'support-v4'
}
compile files('libs/easyandroidanimationslibrary-v0.5.jar')
compile 'com.android.support:recyclerview-v7:21.0.3'
compile files('libs/AndroidCountryPicker-master.jar')
}
If anyone could help me how to use the camera library would be great. 如果有人可以帮助我如何使用相机库,那就太好了。
This library is build with Eclipse and doesn't provide a gradle support. 该库是使用Eclipse构建的,不提供gradle支持。
Also this lib has some resources, then you can use a jar file. 另外,这个库有一些资源,那么您可以使用一个jar文件。
Remove libs/AndroidCountryPicker-master.jar
and remove this line from your build.gradle
: 删除
libs/AndroidCountryPicker-master.jar
并从build.gradle
删除此行:
compile files('libs/AndroidCountryPicker-master.jar')
You have to: 你必须:
root/library1
folder. root/library1
文件夹中克隆https://github.com/roomorama/AndroidCountryPicker/tree/master/CountryPicker文件夹。 You should have somenthing like: 您应该有类似的东西:
root:
library1
build.gradle
app
build.gradle
settings.gradle
Change your settings.gradle
file in 更改您的
settings.gradle
文件
include ':library1' include ':app'
In your app/build.gradle
file you have to add: 在您的
app/build.gradle
文件中,您必须添加:
dependencies {
// Module Library
compile project(':library1')
}
Finally in your library1/build.gradle
you have to add something like this: 最后,在
library1/build.gradle
您必须添加以下内容:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.3'
}
}
apply plugin: 'com.android.application'
android {
lintOptions {
abortOnError false
}
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
targetSdkVersion 22
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.