【问题标题】:Failed to resolve : Could not resolve project:MyProject in Andorid Studio 3.0 Canary 4无法解决:无法解决项目:Android Studio 3.0 Canary 4 中的我的项目
【发布时间】:2017-06-23 08:44:34
【问题描述】:

我正在尝试使用带有原生 java 支持的 android studio canary 4。但我不断收到消息说找不到模块之一

Error:Failed to resolve: Could not resolve project :MyProject
    project :BaseProject

MyProject 存在于目录中。它出现在 android studio 的模块列表中。它存在于settings.gradle。我注意到这是一件非常奇怪的事情。可能是什么问题呢?这是我的根 build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        mavenCentral()
        jcenter()
    }
    dependencies {
        classpath gradlePlugin
        classpath 'com.google.gms:google-services:1.5.0-beta2'
    }
}
allprojects {

    repositories {
        flatDir {
            dir 'libs'
        }
        maven {
            url "https://s3-ap-southeast-1.amazonaws.com/godel-elease/godel/"
        }
        maven { url "https://jitpack.io" }
        maven { url 'http://download.crashlytics.com/maven' }
        maven { url 'https://maven.fabric.io/public' }
    }
}

【问题讨论】:

    标签: android android-studio


    【解决方案1】:

    我遇到了同样的问题,在尝试了不同的事情后我解决了它,在两个模块(库和基础项目)中添加了相同的 buildVariants,在我的例子中只有 release{},所以库模块就像:

    android {
    ...
    
    flavorDimensions "your"
    
    buildTypes {
        release {}
    }
    

    }

    【讨论】:

      【解决方案2】:

      我遇到了和你一样的问题,但是使用 android 模块(即时应用程序),并且自 Beta 4 以来,Alexanders 解决方案不再起作用(但这是正确的方法)。所以我在 StackOverflow 上找到了this other answer。 TL;DR

      现在您可以在 buildType 节点中指定回退,而不是 buildTypeMatching ‘staging’, ‘debug’:

      android {
      ...
      buildTypes {
      ...
      staging {
           matchingFallbacks = ["debug"]
      }
      

      希望这会有所帮助!

      【讨论】:

        猜你喜欢
        • 2018-06-30
        • 1970-01-01
        • 1970-01-01
        • 2020-06-04
        • 2019-03-17
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多