0

I host my library with Github repo and created a release with JitPack. Now when I want to get it with Android Studio, I get this error message:

Failed to resolve: com.github.AhmedCommando:emojis_managers:v1.1

This is my build Gradle:

apply plugin: 'com.github.dcendents.android-maven'
group='com.github.AhmedCommando'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard->android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile 'com.android.support:appcompat-v7:23.+'
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
}

// build a jar with source files
task sourcesJar(type: Jar) {
    from android.sourceSets.main.java.srcDirs
    classifier = 'sources'
}

task javadoc(type: Javadoc) {
    failOnError  false
    source = android.sourceSets.main.java.sourceFiles
    classpath +=     project.files(android.getBootClasspath().join(File.pathSeparator))
    classpath += configurations.compile
}

// build a jar with javadoc
task javadocJar(type: Jar, dependsOn: javadoc) {
    classifier = 'javadoc'
    from javadoc.destinationDir
}

artifacts {
    archives sourcesJar
    archives javadocJar
}

This is how I app build Gradle:

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

Thank you for your help.

pillravi
  • 4,035
  • 5
  • 19
  • 33
Ahmed Commando
  • 723
  • 2
  • 7
  • 23

2 Answers2

1

Try this:----

Step 1. Add the JitPack maven repository to the list of repositories:

 url "https://jitpack.io"

Step 2. Add the dependency information:

 Group: com.github.Username
 Artifact: Repository Name
 Version: Release tag, commit hash or -SNAPSHOT

That's it! The first time you request a project JitPack checks out the code, builds it and sends the Jar files back to you.

To see an example head to jitpack.io and 'Look Up' a GitHub repository by url.

Gradle example:

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

   dependencies {
        compile 'com.github.User:Repo:Version'
   }

Note: when using multiple repositories in build.gradle it is recommended to add JitPack at the end. Gradle will go through all repositories in order until it finds a dependency.

Snapshots

Snapshot versions are useful during development. A snapshot is a version that has not been released. The difference between a real version and a snapshot is that snapshot might still get updates. Snapshot versions are useful during development process and JitPack provides two ways to get them. You can specify a version for your dependency as:

commit hash

branch-SNAPSHOT (replace 'branch' with any branch name, e.g. master)

For example:

 // dependency on the latest commit in the master branch
    compile 'com.github.jitpack:gradle-simple:master-SNAPSHOT'
k3b
  • 14,517
  • 7
  • 53
  • 85
Nitin Singh
  • 145
  • 6
0

have you added the compile portion to the gradle?

dependencies {
            compile 'com.github.AhmedCommando:emojis_managers:v1.1'
    }

I do not see that in the gradle that you have posted

rakesh kashyap
  • 1,418
  • 22
  • 41