【问题标题】:Flutter Android Studio Failed to resolve: androidx.legacy:legacy-support-v4:27.0.1 errorFlutter Android Studio 无法解决:androidx.legacy:legacy-support-v4:27.0.1 错误
【发布时间】:2019-10-30 02:03:35
【问题描述】:

在更新 Flutter 和一些软件包后,我一直得到 ​​p>

无法解决:androidx.legacy:legacy-support-v4:27.0.1 错误

我已将我的项目迁移到 Android X 和 gradle build 28,但错误不会清除。请帮忙。这是我的app/build.gradle的sn-p:

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'

【问题讨论】:

    标签: android flutter android-gradle-plugin build.gradle androidx


    【解决方案1】:

    无法解决:androidx.legacy:legacy-support-v4:27.0.1 错误

    这是因为 androidx.legacy:legacy-support-v4:27.0.1 不存在。

    您可以查看official doc 和legacy-support package 的发行说明。

    用途:

    api 'androidx.legacy:legacy-support-v4:1.0.0'
    

    您也可以查看google maven repo。这里是可用版本的列表:

    1.0.0-alpha1
    1.0.0-alpha3
    1.0.0-beta01
    1.0.0-rc01
    1.0.0-rc02
    1.0.0
    

    【讨论】:

      【解决方案2】:

      尝试使用这个:androidx.legacy:legacy-support-v4:1.0.0

      在这里查看更多信息:https://developer.android.com/jetpack/androidx/migrate

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2019-03-27
        • 2019-03-29
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-09-17
        相关资源
        最近更新 更多