Flutter Android Studio Failed to resolve: androidx.legacy:legacy-support-v4:27.0.1 error

1,980

Try using this one: androidx.legacy:legacy-support-v4:1.0.0

Look here for more: https://developer.android.com/jetpack/androidx/migrate

Share:
1,980
Charles Jr
Author by

Charles Jr

Jack of All Trades - Master of Few!! Started with Obj-C.then(Swift)!.now(Flutter/Dart)! Thank everyone for every answer, comment, edit, suggestion. Can't believe I've been able to answer a few myself :-)

Updated on December 12, 2022

Comments

  • Charles Jr
    Charles Jr over 1 year

    After updating Flutter and a few packages I'm consistently getting the

    Failed to resolve: androidx.legacy:legacy-support-v4:27.0.1 error

    I've migrated my project to Android X and gradle build 28, but the error will not clear. Please help. Here is a snippet of my app/build.gradle:

    android {
        compileSdkVersion 28
    
        lintOptions {
            disable 'InvalidPackage'
        }
    
        defaultConfig {
            // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
            applicationId "com.mycompany"
            minSdkVersion 16
            targetSdkVersion 27
            versionCode flutterVersionCode.toInteger()
            versionName flutterVersionName
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
            multiDexEnabled true
        }
    
        buildTypes {
            release {
                // TODO: Add your own signing config for the release build.
                // Signing with the debug keys for now, so `flutter run --release` works.
                signingConfig signingConfigs.debug
            }
        }
    
        configurations.all {
            resolutionStrategy {
                force 'androidx.media:media:1.0.0'
            }
        }
    }
    
    flutter {
        source '../..'
    }
    
    dependencies {
        testImplementation 'junit:junit:4.12'
        androidTestImplementation 'com.android.support.test:runner:1.0.2'
        androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
        implementation 'com.android.support:multidex:1.0.3'
        implementation 'com.android.support:support-v4:28.0.0'
        api 'androidx.legacy:legacy-support-v4:27.0.1'
    
    }
    
    apply plugin: 'com.google.gms.google-services'