How do I Import a library from github in Android Studio? - android

[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.

You dont have to import a module .
Just put the path in your build.gradle dependencies and use it as described.
e.g:
dependencies {
compile ('com.github.florent37:materialviewpager:1.0.3.2#aar'){
transitive = true
}
}

allprojects {
repositories {
jcenter()
mavenCentral()
maven { url "https://jitpack.io" }
}
working code: add maven { url "https://jitpack.io" } to your project level gradle.

Related

Has Mukesh Solanski's OTP Pinview shutdown?

I seems cannot import his github dependencies despite using the right address:
implementation 'com.github.mukeshsolanki:android-otpview-pinview:2.1.2'
When I build, Android Studio cannot find it.
Is there any other alternative? I found chaos pinview but I wanna try his as well.
mvnrepository.com says you can find up to 2.1.0 in the Mulesoft repository. So you need to configure another maven repository in the top-level build.gradle and downgrade the dependency version. Or find another alternative.
You can import the library but for that you need to do the following
maven { url "https://jitpack.io" }
add the above line in settings.gradle like this:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
//add jitpack here
maven { url "https://jitpack.io" }
}
}
rootProject.name = "Example"
include ':app'

Automatically add repositories from dependencies

I have a library with a dependency that requires a custom repo
dependencies {
implementation 'com.chartboost:chartboost-sdk:8.1.0'
}
repositories {
mavenCentral()
maven { url "https://chartboostmobile.bintray.com/Chartboost" }
}
This works fine, but it forces me to add maven { url "https://chartboostmobile.bintray.com/Chartboost" } to every project that uses that library. I would like to know, is there a way to modify my own library so I wouldn't need to add the custom maven repo for that dependency? Something that would add all the repos in the library to the project. I tried switching implementation with api to no avail
You can put your repository into [USER_HOME]/gradle/init.gradle file:
allprojects {
repositories {
mavenCentral()
maven { url "https://chartboostmobile.bintray.com/Chartboost" }
}
}
then they are will be applied to all projects

Jitpack - unable to import android library

I forked a public MediaPicker library and forked it on Github. After making some changes to the library, I made a release of the project. I checked JitPack which is showing all ok for the release but I am still unable to import it. Following is the library url for JitPack
https://jitpack.io/#rohankandwal/MediaPicker/2.3.4
I have checked my root Gradle's setting and made sure that I have following lines added-
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
I tried importing the library by using following code -
compile 'com.github.rohankandwal:MediaPicker:2.3.4'
or
compile 'com.github.rohankandwal:libary:2.3.4'
I have also asked another developer to import library but he is also unable to do so, please advice what am I missing ? The Github link to library is
https://github.com/rohankandwal/MediaPicker
Just replace this from :
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
to:
allprojects {
repositories {
maven {
name "jitpack"
url "https://jitpack.io"
}
}
Happy coding!!

How to Resolve Error:(2, 0) Cannot convert URL Android Studio

i import com.github.QuadFlask:colorpicker with aar file to my project but after gradle sync i see this error and i cant resolve this :(
Screenshot
You can see on Github how to import this library properly.
This library is not released in Maven Central, but instead you can use JitPack
add remote maven url in allprojects.repositories
allprojects {
repositories {
maven { url "https://jitpack.io" }
}
}
then add a library dependency
dependencies {
compile 'com.github.QuadFlask:colorpicker:0.0.13'
}

Problems when trayin to add labrary to android studio

hi i am trying to add MPAndroidChart to my android studio i tried evrything from file>New >Import Module
and tried to copy it directly to my android studio
i put this in the
include':Libraries:MPChartLib'
and this in the dependency
dependencies {
compile 'com.github.PhilJay:MPAndroidChart:v2.2.5' }
but i always keep getting this error
please helppp
Read follow documentation github
Add the following to your build.gradle:
repositories {
maven { url "https://jitpack.io" }
}
dependencies {
compile 'com.github.PhilJay:MPAndroidChart:v2.2.5'
}
add or merge this in your build.gradle script.
repositories {
maven { url "https://jitpack.io" }
}

Categories

Resources