无法解决:com.github 使用 jitpack 错误从 github 添加我的库时。如何解决?

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

我在 github 上构建并添加了带有演示的 this 库。现在,我正在尝试将其导入其他项目。

以下是我的 gradle 未编译的文件。

// 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
}

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'
}

我查看了以下答案

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

我仍然无法解决问题。 Gradle 同步失败并出现错误

Failed to resolve: com.github

为面临同样问题的其他人发布答案。

在 gradle 中导入之后一天或更长时间后,之前无法正常工作。

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

我猜这可能是因为 jitpack 可能需要一些时间来处理库。带有版本名称的依赖仍然不起作用。

我假设版本名称与您在库的 build.graddle 文件中指定的版本名称相同。

感谢 jitpack 团队。问题是我需要通过执行更多步骤在 github 上发布存储库。

  • 转到发布选项卡
  • 创建新版本