Android studio build fails

Viewed 293

I receive following warnings when I sync Gradle in Android Studio 4.1.2 from stable channel :

Failed to resolve: legacy-support-v4-1.0.0
Failed to resolve: asynclayoutinflater-1.0.0
Failed to resolve: media-1.0.0
Failed to resolve: swiperefreshlayout-1.0.0
Failed to resolve: slidingpanelayout-1.0.0
Failed to resolve: legacy-support-core-ui-1.0.0

Here is my app module build.gradle file :

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

apply plugin: 'kotlin-kapt'

apply plugin: 'androidx.navigation.safeargs.kotlin'

androidExtensions {
    experimental = true
}

android {
    compileSdkVersion rootProject.ext.compileSdkVersion
    defaultConfig {
        applicationId "com.sample.android.storytel"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 1
        versionName "1.0"
        buildConfigField "String", "STORYTEL_BASE_URL", "\"https://jsonplaceholder.typicode.com/\""
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

    dataBinding {
        enabled = true
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    // Support libraries
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$version_kotlin"
    implementation "androidx.appcompat:appcompat:$version_support"
    implementation "com.google.android.material:material:$version_material"
    implementation "androidx.constraintlayout:constraintlayout:$version_constraint_layout"
    implementation "androidx.palette:palette-ktx:$version_palette"
    implementation "androidx.test.espresso:espresso-idling-resource:$version_espresso"

    // Android KTX
    implementation "androidx.core:core-ktx:$version_core"

    // Navigation
    implementation "androidx.navigation:navigation-fragment-ktx:$version_navigation"

    // Architecture components
    implementation "androidx.lifecycle:lifecycle-extensions:$version_lifecycle_extensions"

    // Retrofit
    implementation "com.squareup.retrofit2:retrofit:$version_retrofit"
    implementation "com.squareup.retrofit2:converter-moshi:$version_retrofit"
    implementation "com.squareup.retrofit2:adapter-rxjava2:$version_retrofit"

    // Dagger
    implementation "com.google.dagger:dagger:$version_dagger"
    kapt "com.google.dagger:dagger-compiler:$version_dagger"
    implementation "com.google.dagger:dagger-android:$version_dagger"
    implementation "com.google.dagger:dagger-android-support:$version_dagger"
    kapt "com.google.dagger:dagger-android-processor:$version_dagger"

    // Network
    implementation "com.squareup.okhttp3:logging-interceptor:$version_okhttp"
    implementation "com.squareup.picasso:picasso:$version_picasso"
    implementation "com.github.florent37:picassopalette:$version_picasso_palette"

    // Moshi for parsing the JSON format
    implementation "com.squareup.moshi:moshi:$version_moshi"
    implementation "com.squareup.moshi:moshi-kotlin:$version_moshi"

    //Android RX
    implementation "io.reactivex.rxjava2:rxjava:$version_rxjava"
    implementation "io.reactivex.rxjava2:rxandroid:$version_rxandroid"

    // Timber
    implementation "com.jakewharton.timber:timber:$version_timber"

    // Dependencies for local unit tests
    testImplementation "org.mockito:mockito-core:$version_mockito"

    // Dependencies for Instrumentation tests
    androidTestImplementation "androidx.test.ext:junit:$version_junit_ext"

    // Espresso UI Testing
    androidTestImplementation "androidx.test.espresso:espresso-core:$version_espresso"
    androidTestImplementation "androidx.test.espresso:espresso-contrib:$version_espresso"

    // Testing Architecture components
    testImplementation "androidx.arch.core:core-testing:$version_lifecycle_test"

    // Android Testing Support Library's runner and rules
    androidTestImplementation "androidx.test:runner:$version_runner"
    androidTestImplementation  "androidx.test:rules:$version_rules"

    // AndroidX Test - JVM testing
    testImplementation "androidx.fragment:fragment-testing:$version_fragment"
}

When I build the project, I receive following error :

Could not resolve asynclayoutinflater-1.0.0.aar (androidx.asynclayoutinflater:asynclayoutinflater:1.0.0)

Here you can find my project : https://github.com/Ali-Rezaei/Colors

Do you know why it happens and how to resolve it?

Addenda : I realized it is related to following dependency :

implementation "com.github.florent37:picassopalette:$version_picasso_palette"

Without this dependency, it works as expected.

3 Answers

You live in a country that is under sanctions. You must use a filter breaker.

you can use this

The problem here is with implementation "com.github.florent37:picassopalette:$version_picasso_palette" is that this library is that it uses support library dependencies of android and you are trying to use it in a project where you are using jetpack library.

You can resolve it by

  1. Using a version of that library which is migrated to JetPack..

OR

You can download the zip of that library and extract it and then open it as a project and then from refactor menu migrate to AndroidX then you import that custom project as a library into your project.

Could not resolve asynclayoutinflater-1.0.0.aar (androidx.asynclayoutinflater:asynclayoutinflater:1.0.0)

This means gradle cannot find that dependency anywhere. Make sure that the library can be accessed by gradle inorder to resolve the problem.

Basically gradle is seeing your dependency as some unresolvable gibberish.

Related