Search code examples
androiddeprecatedjcenter

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'

Solution

  • 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"
    }