Getting Failed to resolve: com.github while adding my library from github using jitpack Error. How to resolve?

牧云@^-^@ 提交于 2019-12-24 18:53:11

问题


I build and added this library with demo on github. Now, I am trying to import it on other project.

Following are my gradle files that are not compiling.

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
    }
}

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

task clean(type: Delete) {
    delete rootProject.buildDir
}

and

apply plugin: 'com.android.application'

android {
  compileSdkVersion 28
  defaultConfig {
    applicationId "com.mayank.myapplication"
    minSdkVersion 16
    targetSdkVersion 28
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
      }
  }
}

dependencies {
  implementation fileTree(dir: 'libs', include: ['*.jar'])
  implementation 'com.github.mayank1513:SP_DrawerLayout:1.0'
  testImplementation 'junit:junit:4.12'
  androidTestImplementation 'com.android.support.test:runner:1.0.2'
  androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

I looked at following answers

  1. Error:(23, 20) Failed to resolve: com.github.chrisbanes:PhotoView:2.1

  2. Android Studio Failed to resolve:com.github.PhilJay:MPAndroidChart:v2.1.3

  3. jitpack.io failed to resolve github repo

I am not able to resolve the issue still. Gradle Sync fails with error

Failed to resolve: com.github


回答1:


Posting answer for anyone else facing same issue.

After a day or more now following import in graddle works which wasn't working earlier.

dependencies {
    implementation 'com.github.mayank1513:SP_DrawerLayout:master-SNAPSHOT'

I guess that might be because jitpack may be taking some time to process the library. The dependency with version name still doesn't work.

I assume that version name is same as the version name you specify inside your library's build.graddle file.

Thanks to the jitpack team. The problem was that I needed to release the repository on github by following a few more steps.

  • go to release tab
  • Create new release


来源:https://stackoverflow.com/questions/53668250/getting-failed-to-resolve-com-github-while-adding-my-library-from-github-using

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!