美文网首页
flutter Required by: project :ap

flutter Required by: project :ap

作者: kindom_0129 | 来源:发表于2020-07-11 23:20 被阅读0次

最近在flutter项目上突然遇到了此类问题(之前都是好好的):

//XXX 是代表某一个第三方库
Could not resolve all task dependencies for configuration ‘:XXX:debugCompileClasspath’.
Could not resolve project :XXX_macos.
Required by:
project :XXX
Unable to find a matching configuration of project :XXX_macos:
- None of the consumable configurations have attributes.
Could not resolve project :XXX_web.
Required by:
project :XXX
Unable to find a matching configuration of project :XXX_web:
- None of the consumable configurations have attributes.

查找了很多资料,主要有以下几种方案:

1.flutter clean之后重新rebuild

2.修改镜像:

buildscript {
    ext.kotlin_version = '1.3.50'
    repositories {
//        google()
//        jcenter()
        maven { url 'https://maven.aliyun.com/repository/google' }
        maven { url 'https://maven.aliyun.com/repository/jcenter' }
        maven { url 'http://maven.aliyun.com/nexus/content/groups/public' }
        mavenLocal()
        mavenCentral()
    }
 
    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}
 
allprojects {
    repositories {
//        google()
//        jcenter()
        maven { url 'https://maven.aliyun.com/repository/google' }
        maven { url 'https://maven.aliyun.com/repository/jcenter' }
        maven { url 'http://maven.aliyun.com/nexus/content/groups/public' }
        mavenLocal()
        mavenCentral()
    }

3.修改配置为:

url "http://download.flutter.io"

4.删除项目里Android目录下.gradle文件夹,然后clean,重新编译

  • 但是以上方法都无效,之后索性删除了错误信息里提到的插件(比如:shared_preferences)就好了

找到你的flutter的目录,然后找到.pub-cache/hosted/pub.flutter-io.cn的目录,把目录里面所有xxx_web和xxx_macos的文件夹删除掉,然后直接运行你的flutter项目即可。

相关文章

网友评论

      本文标题:flutter Required by: project :ap

      本文链接:https://www.haomeiwen.com/subject/iouwcktx.html