2

I am trying to use android studio canary 4 with native java support. But I keep getting the message saying that one of the modules is not found

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

MyProject is present in the directory. It appears in the list of modules in android studio. It is present in settings.gradle. This is a very weird thing that I am noticing. What could be the problem? This is my root 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' }
    }
}
Ashwin
  • 12,691
  • 31
  • 118
  • 190

2 Answers2

0

I had the same issue, after trying different things I solved it adding the same buildVariants in both modules (library and base project), in my case only had release{} so the library module is like:

android {
...

flavorDimensions "your"

buildTypes {
    release {}
}

}

JavierSP1209
  • 899
  • 8
  • 17
0

I experienced the same problem like you, but with android modules (instant app), and Alexanders solution doesn't work anymore (but it's the right way), since Beta 4. So I found this other answer on StackOverflow. TL;DR

Instead of buildTypeMatching ‘staging’, ‘debug’ you now specify the fallback inside your buildType node:

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

Hope this helps!

Zhyano
  • 399
  • 1
  • 3
  • 13