Amit Yadav
Amit Yadav

Reputation: 35074

mavenCentral() is not working instead jcenter()

mavenCentral() is not working instead jcenter(). When I use mavenCentral() I am getting below error message,

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

With jcenter() above error is not coming.

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.

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()
    }
}

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

Upvotes: 6

Views: 4930

Answers (2)

CommonsWare
CommonsWare

Reputation: 1006964

There is no flexbox on Maven Central. There is a flexbox on Google's Maven repo, but only 3.0.0. Some transitive dependency of yours is seeking 2.0.1. And, based on that dependency list, it must be io.kommunicate.sdk:kommunicateui:2.1.8 that is looking for the older flexbox.

Unfortunately, the developers of io.kommunicate.sdk:kommunicateui have not updated their library, apparently.

You can try manually adding your own dependency on com.google.android.flexbox:flexbox:3.0.0 and perhaps setting up an exclude rule on the io.kommunicate.sdk:kommunicateui:2.1.8 dependency to tell Gradle to ignore its transitive dependency on flexbox. Ideally, the developers of io.kommunicate.sdk:kommunicateui would update their library to depend on com.google.android.flexbox:flexbox:3.0.0.

To exclude the failing dependency, change:

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

to:

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

Upvotes: 7

Skizo-ozᴉʞS ツ
Skizo-ozᴉʞS ツ

Reputation: 20626

The problem is in the FlexBox Layout library

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

You get 403 forbidden for any reason. There's a mavenCentral() artifact using the flexbox 3.0.0 in case you could use that one.

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

You should add this dependency (or add exclude rule in your io.kommunicate.sdk:kommunicateui:2.1.8 or the one that is using flexbox)

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

For more info read this thread

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

Upvotes: 3

Related Questions