mavenCentral() 不工作,而是 jcenter()

mavenCentral() is not working instead jcenter()

mavenCentral() 代替 jcenter() 不工作。当我使用 mavenCentral() 时,我收到以下错误消息,

Could not HEAD 'https://google.bintray.com/flexbox-layout/com/google/android/flexbox/2.0.1/flexbox-2.0.1.pom'. Received status code 403 from server: Forbidden
Disable Gradle 'offline mode' and sync project

上面的 jcenter() 不会出现错误。

Can I use jcenter() in my project even after jcenter() is deprecated. What is the last date of jcenter() to be use in our project.

项目build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.3'
        classpath 'com.google.gms:google-services:4.3.8'
        //classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.24.4"
    }
}

allprojects {
    /*apply plugin: 'com.jfrog.artifactory'
    apply plugin: 'maven-publish'*/

    repositories {
        google()
        mavenCentral()
    }
}

模块build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 30
    defaultConfig {
        applicationId "io.kommunicate.app"
        minSdkVersion 16
        targetSdkVersion 30
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

          //Sensitive data
    }

    buildTypes {
        release {
            minifyEnabled false
            shrinkResources false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            minifyEnabled false
            shrinkResources false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
        //jcenter()
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    //api project(':kommunicateui')
    implementation 'io.kommunicate.sdk:kommunicateui:2.1.8'
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.multidex:multidex:2.0.1'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}

apply plugin: 'com.google.gms.google-services'

Maven Central 上没有 flexbox。在 Google's Maven repo 一个 flexbox,但只有 3.0.0。你的一些传递依赖正在寻找 2.0.1。并且,根据该依赖列表,它必须是 io.kommunicate.sdk:kommunicateui:2.1.8 正在寻找较旧的 flexbox.

不幸的是,io.kommunicate.sdk:kommunicateui 的开发人员显然没有更新他们的库。

您可以尝试手动添加您自己对 com.google.android.flexbox:flexbox:3.0.0 的依赖,或许可以在 io.kommunicate.sdk:kommunicateui:2.1.8 依赖上设置一个 exclude 规则来告诉 Gradle 忽略它的传递依赖在 flexbox 上。理想情况下,io.kommunicate.sdk:kommunicateui 的开发人员会更新他们的库以依赖于 com.google.android.flexbox:flexbox:3.0.0

要排除失败的依赖项,请更改:

implementation 'io.kommunicate.sdk:kommunicateui:2.1.8'

至:

implementation('io.kommunicate.sdk:kommunicateui:2.1.8') {
  exclude group: "com.google.android", module: "flexbox"
}

问题出在FlexBox Layout library

https://google.bintray.com/flexbox-layout/com/google/android/flexbox/2.0.1/flexbox-2.0.1.pom

无论出于何种原因,您都会收到 403 禁止。有一个使用 flexbox 3.0.0mavenCentral() 神器,以防你可以使用它。

https://maven.google.com/web/index.html?q=flexbox#com.google.android.flexbox:flexbox:3.0.0

您应该添加此依赖项(或在 io.kommunicate.sdk:kommunicateui:2.1.8 或使用 flexbox 的那个中添加排除规则)

dependencies {
    ....
    implementation 'com.google.android.flexbox:flexbox:3.0.0'
    ....
}

有关详细信息,请阅读此线程

https://github.com/google/flexbox-layout/issues/566#issuecomment-844630491