androidgradle

I can't connect the library from github


Failed to resolve: com.jcodecraeer:xrecyclerview:1.6.0
Failed to resolve: com.github.smarteist:autoimageslider:1.1.1
Failed to resolve: com.android.volley:volley:1.1.1
Failed to resolve: com.pierfrancescosoffritti.androidyoutubeplayer:core:8.0.1
Failed to resolve: tv.danmaku.ijk.media:ijkplayer-java:0.8.8
Failed to resolve: tv.danmaku.ijk.media:ijkplayer-armv7a:0.8.8
Failed to resolve: tv.danmaku.ijk.media:ijkplayer-armv5:0.8.8
Failed to resolve: tv.danmaku.ijk.media:ijkplayer-arm64:0.8.8
Failed to resolve: tv.danmaku.ijk.media:ijkplayer-x86:0.8.8
Failed to resolve: tv.danmaku.ijk.media:ijkplayer-x86_64:0.8.8

My build.gradle(app) file

apply plugin: 'com.android.application'

android {
compileSdkVersion 34
namespace "com.androworld.player.video_player"
defaultConfig {
    applicationId "com.androworld.player.video_player"
    minSdkVersion 21
    targetSdkVersion 34
    versionCode 40
    versionName "4.2.8"
    multiDexEnabled true
    ndk {
        // config you want to support device
        abiFilters 'arm64-v8a', 'armeabi', 'armeabi-v7a', 'x86'
    }
    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
    debugMini {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
configurations.all {
    resolutionStrategy {
        force 'androidx.annotation:annotation:1.2.0'
    }
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.android.support') {
            if (!requested.name.startsWith("multidex")) {
                details.useVersion '28.0.0'
            }

        }

    }

}

//    sourceSets.main {
//        jniLibs.srcDirs 'src/main/libs'
//    }

}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
//noinspection GradleCompatible
//implementation 'androidx.annotation:annotation:1.2.0'
//implementation 'androidx.annotation:annotation-jvm:1.7.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'androidx.multidex:multidex:2.0.1'
//support
implementation 'com.google.android.material:material:1.1.0'
implementation 'com.jcodecraeer:xrecyclerview:1.6.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.github.bumptech.glide:glide:4.9.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
//vector,percent,palette
implementation 'androidx.palette:palette:1.0.0'
implementation 'androidx.percentlayout:percentlayout:1.0.0'
implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
//equlizer
implementation 'com.joanzapata.iconify:android-iconify-fontawesome:2.2.2'
implementation 'com.joanzapata.iconify:android-iconify-entypo:2.2.2'
//    implementation 'androidx.legacy:legacy-support-v4:1.0.0'

implementation 'com.github.smarteist:autoimageslider:1.1.1'
//data
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.android.volley:volley:1.1.1'
implementation 'org.apache.commons:commons-io:1.3.2'
//youtubeplayer
implementation 'com.pierfrancescosoffritti.androidyoutubeplayer:core:8.0.1'
//    implementation 'com.pierfrancescosoffritti.androidyoutubeplayer:core:10.0.5'
//Ads
//implementation 'com.google.android.gms:play-services-ads:20.4.0'
//intro_screen
implementation project(':material-intro-screen')
//player
implementation 'tv.danmaku.ijk.media:ijkplayer-java:0.8.8'
implementation 'tv.danmaku.ijk.media:ijkplayer-armv7a:0.8.8'
implementation 'tv.danmaku.ijk.media:ijkplayer-armv5:0.8.8'
implementation 'tv.danmaku.ijk.media:ijkplayer-arm64:0.8.8'
implementation 'tv.danmaku.ijk.media:ijkplayer-x86:0.8.8'
implementation 'tv.danmaku.ijk.media:ijkplayer-x86_64:0.8.8'

//    implementation project(':ijkplayer-java')
//    implementation 'tv.danmaku.ijk.media:ijkplayer-exo:0.8.8'

//    implementation project(':xvideoplayer')
//    implementation 'com.henryblue.mxvideoplayer:xvideoplayer:1.2.1'
implementation 'com.firebase:firebase-client-android:2.5.0'
implementation 'com.yandex.android:mobileads:5.10.0'
implementation 'com.yandex.android:mobmetricalib:5.0.0'
//implementation 'com.google.android.gms:play-services-ads:17.2.1'

//implementation 'com.facebook.android:audience-network-sdk:5.3.0'

implementation 'androidx.work:work-runtime-ktx:2.7.1' //no started android api 32
}

settings.gradle(Project)

pluginManagement {
repositories {
    google()
    mavenCentral()
    gradlePluginPortal()
    maven { url "https://www.jitpack.io" }
}
}

plugins {
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.8.0'
}

dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
    google()
    mavenCentral()
    jcenter() // Note: JCenter is deprecated and should be avoided if possible
    maven { url "https://www.jitpack.io" }
    maven {
        url "https://artifactory-external.vkpartner.ru/artifactory/maven"
    }
    maven { url 'https://dl.bintray.com/yandexmobile/maven' } // Likely deprecated, use 
alternatives
    maven { url "https://raw.github.com/embarkmobile/zxing-android-minimal/mvn-repo/maven- 
repository/" }
    maven { url "https://dl.bintray.com/theartofdev/Edmodo" } // Deprecated
}
}

include ':app', ':material-intro-screen'

Solution

  • Cross-posting this material from my blog:


    While there can be a few causes for this, the one that is tripping up a lot of developers now stems from the fact that JCenter's Maven repository, used by many library publishers, no longer exists.

    For actively-published libraries, the library developers would have moved elsewhere by now. For many developers, the best answer would be Maven Central, though some have other options. Google, for example, has the latest version of Volley available through their own Maven repository.

    However, there are a lot of not-actively-published libraries. Those are probably gone for good.

    The reason the JCenter change is not affecting everyone at the same time comes down to Gradle caches. Gradle caches artifacts and only tries downloading them when needed, such as:

    Those latter two probably are the ones that cause the most JCenter-related grief. Some build that worked before and perhaps works elsewhere (e.g., on a coworker's machine) does not work for you, because "elsewhere" has the artifact cached and you do not. Teams using CI servers that retrieve artifacts on every build might have found out within a day of the JCenter shutdown. Those using just local build machines might not find out for years, depending on how long they keep their Gradle artifact cache around.


    So, what do you do if you get caught by this?

    First, search "teh interwebs" for the library to see if there is a site regarding it. Many of these libraries were developed in the open in places like GitHub. See if that site has instructions for some newer maintained version, and migrate to it. Conversely, if the library has not been update in years, please consider moving to something that is actively maintained.

    You could also search MvnRepository. This is an index of several different artifact repositories, including Maven Central and Google's Maven repository. It used to index JCenter, and it also has some other less-common Maven repositories. Perhaps you will find another source for the particular artifact that you need. However, be careful when depending on a semi-random library from an even more random repository — you are asking to become the victim of a supply-chain attack.

    If the source is available on GitHub or elsewhere, you could fork the source and maintain your own copy. Whether you make that available to the public (e.g., on Maven Central) or just share it with your team is up to you. Maven Local is a quick-and-dirty way to have a Maven repository on your machine for artifacts. Setting up a private shared repository, such as via Amazon S3, is eminently doable, if slightly arcane.

    Going forward, aim to do a clean build on a clean environment periodically. Even if you do not elect to go for a nightly CI server job, do a build once a month on an environment that lacks a Gradle cache. Part of the value in those builds is to more rapidly identify problems like this, so you can take steps before the problem starts affecting the productivity of individual developers.