I have created a library project using android studio and uploaded it on Github
What I want to do is, make the project available to anyone wanting to use it with this simple gradle command.
dependencies {
compile 'com.github.myprojectname'
}
How can I do it?
To use a project in github with gradle:
publish it in MavenCentral or Jcenter
use JitPack
In this case add the repo:
repositories {
// ...
maven { url "https://jitpack.io" }
}
and add the dependency like this:
dependencies {
compile 'com.github.User:Repo:Tag'
}
If you want to publish an artifact on MavenCentral, you can read this post.
You should upload your project on maven central or jcenter or on your own repository somewhere on the internet.
Then in the gradle.build your users specify:
repositories {
mavenCentral()
}
or similar and then they specify your dependency
dependencies {
compile 'com.github.myprojectname+'
}
Related
So this is a little new to me, I am using adblock project and showing my website from webviewer but i want to not show my website's ads into it, so i used adblock project for the same. But somehow i am getting this weird error of not founding
com.google.android.gms:play-services-ads:15.0.0
Failed to resolve: com.google.android.gms:play-services-ads:15.0.0
Install Repository and sync project
Show in File
Show in Project Structure dialog
After i clicked on Install Repository and sync project the SDK manager says
Could not find dependency "com.google.android.gms:play-services-ads:15.0.0"
Configs:
In build.gradle(project)
buildscript {
repositories {
mavenLocal()
mavenCentral()
jcenter()
maven {
url "https://maven.google.com"
}
And in build.gradle(Module:libadblockerplus-android-webviewapp)
dependencies {
compile project(':libadblockplus-android-settings')
compile project(':libadblockplus-android-webview')
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.google.android.gms:play-services-ads:15.0.0'
}
adding
maven {
url "https://maven.google.com"
}
to the other repositories block in your build.gradle file. Fixed the issue. Thanks #stkent
You should add
maven {
url "https://maven.google.com"
}
to the other repositories block in your build.gradle file.
From your posted snippet, it appears you have already added it to the buildscript block's list of repositories. However, those repositories are only used to search for dependencies for the building of your application. See this SO question for more discussion on the difference between the repositories and buildscript.repositories blocks.
Failed to resolve: com.android.support.constraint:constraint-layout:1.0.2
I see this error when I open my projectI cant install constraint-layout:1.0.2, there is some error strong text
Your project's build.gradle should have the content as below.
All the Google specific dependencies are now hosted on their own Maven Repository.
If you still find it confusing, just create a new Project from scratch using Android Studio 3.0.1 and all the dependencies would be properly configured.
buildscript {
repositories {
google() // Speficically this entry
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
First of all, make sure to update your Android Studio. Second thing, make sure you import the Google maven repository into your project gradle file. Then, you should be able to install ConstraintLayout.
Here's the solution:
repositories {
maven {
url 'https://maven.google.com'
}
}
then add this line in dependencies:
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support.constraint:constraint-layout-solver:1.0.2'
I want to compile with com.squareup.picasso:picasso:2.5.3-SNAPSHOT. But i got this error:
Error:Could not find com.squareup.picasso:picasso:2.5.3-SNAPSHOT.
Required by:
familywall-android:app:unspecified
Search in build.gradle files
Have someone experienced something similar?
The Picasso snapshot version you mentioned is not available in the standard maven repo. In your build.gradle add the following dependency to your dependencies block:
dependencies {
// 2.5.3 is no longer updated.
compile 'com.squareup.picasso:picasso:3.0.0-SNAPSHOT'
//...
}
and in the repositories block add
repositories {
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
//...
}
I found the .jar here, the last version is 21. It worked!
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" }
}
I'm trying to import the drag-sort-listview android library into my application in Android Studio. I had no problems using it with Eclipse before.
Git repository for library: https://github.com/bauerca/drag-sort-listview
Nowadays, you can just add the dependency in your build.gradle as:
repositories {
mavenCentral()
}
dependencies {
compile 'asia.ivity.android:drag-sort-listview:1.0'
}
All you need to do is to define the dependency on it in your build.gradle file.
repositories {
mavenCentral()
}
dependencies {
compile 'asia.ivity.android:drag-sort-listview-apklib:1.0#apklib'
}