mavenCentral() is not working instead jcenter()
Asked Answered
A

2

7

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'
Anthill answered 23/8, 2021 at 11:8 Comment(7)
Can you post your build.gradle please?Corrientes
@Skizo-ozᴉʞS I added app build.gradle. Please see.Anthill
could you remain the jcenter() ? There are still some apis that needs that. Keep both.Corrientes
Also add your build.gradle of your project please, not of appCorrientes
Use a vpn if your country is sanctioned by google (403 : Forbidden)Selfrising
I use implementation("com.github.google:flexbox-layout:2.0.1") for flexbox after removal of jcenter in the projectGrettagreuze
@Grettagreuze I used implementation("com.github.google:flexbox-layout:2.0.1") but still getting the same error.Anthill
T
8

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"
}
Trolly answered 23/8, 2021 at 11:31 Comment(3)
I added implementation 'com.google.android.flexbox:flexbox:3.0.0' but getting same error.Anthill
@AmitYadav: Then you probably also need to exclude the failing dependency -- I updated my answer to show the syntax for that.Trolly
I excluded implementation('io.kommunicate.sdk:kommunicateui:2.1.8') { exclude group: "com.google.android", module: "flexbox" } and its workingAnthill
L
3

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

Lonesome answered 23/8, 2021 at 11:39 Comment(3)
I added implementation 'com.google.android.flexbox:flexbox:3.0.0' but getting same error.Anthill
Have you put the exclude in your library where you use flexbox? Also have you tried the close the project and clear cache and restart?Corrientes
I didn't exclude. Can you plz tell me how to do that. I cleared the cache but it's not workingAnthill

© 2022 - 2025 — McMap. All rights reserved.