如何从Android Studio中的github导入库?

时间:2022-03-11 00:37:42

[I'm a newbie] I want to include a git library in android studio -> https://github.com/florent37/MaterialViewPager I tried this. New-> import module -> downloaded file address But it's giving some errors.

[我是新手]我想在android studio中包含一个git库 - > https://github.com/florent37/MaterialViewPager我试过这个。 New-> import module - >下载的文件地址但它给出了一些错误。

2 个解决方案

#1


You dont have to import a module . Just put the path in your build.gradle dependencies and use it as described. e.g:

你不必导入一个模块。只需将路径放在build.gradle依赖项中,然后按照描述使用它。例如:

dependencies {

compile ('com.github.florent37:materialviewpager:1.0.3.2@aar'){
    transitive = true
    }
}

#2


allprojects {
repositories {
    jcenter()
    mavenCentral()
    maven { url "https://jitpack.io" }
}

working code: add maven { url "https://jitpack.io" } to your project level gradle.

工作代码:将maven {url“https://jitpack.io”}添加到项目级别gradle。

#1


You dont have to import a module . Just put the path in your build.gradle dependencies and use it as described. e.g:

你不必导入一个模块。只需将路径放在build.gradle依赖项中,然后按照描述使用它。例如:

dependencies {

compile ('com.github.florent37:materialviewpager:1.0.3.2@aar'){
    transitive = true
    }
}

#2


allprojects {
repositories {
    jcenter()
    mavenCentral()
    maven { url "https://jitpack.io" }
}

working code: add maven { url "https://jitpack.io" } to your project level gradle.

工作代码:将maven {url“https://jitpack.io”}添加到项目级别gradle。