5

Android studio cannot find a dependency which is obviously in my local repository. Error:

Error:Failed to find: com.poppy:tutti-frutti-dtos:1.0.0-SNAPSHOT Open File
Open in Project Structure dialog

I am using the gradle wrapper and Android studio 1.0.2. I have double checked the name of my dependency and I have the following build.gradle file for the project. I have also tried with mavenLocale() which doesn't not seem to work either. Any advice to debug this?

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        maven { url 'D:/Users/Math/.m2/repository' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.0.0'


        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects{
    repositories {
        jcenter()
        maven { url 'D:/Users/Math/.m2/repository' }
    }
}

Here is the dependency section of the module build.gradle file of my project:

apply plugin: 'com.android.application'
dependencies {
    compile 'com.google.android.gms:play-services:6.1.11'
    compile 'org.springframework.android:spring-android-rest-template:2.0.0.M1'
    compile 'com.google.code.gson:gson:2.3'
    compile 'com.android.support:appcompat-v7:21.0.+'
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.pnikosis:materialish-progress:1.2'
compile 'com.poppy:tutti-frutti-dtos:1.0.0-SNAPSHOT'
    androidTestCompile 'junit:junit:4.+'
}

My library is located here: D:\Users\Math.m2\repository\com\poppy\tutti-frutti-dtos\1.0.0-SNAPSHOT And there are four files under that folder:

  • _remote.repositories
  • maven-metadata-local.xml
  • tutti-frutti-dtos-1.0.0-SNAPSHOT.jar
  • tutti-frutti-dtos-1.0.0-SNAPSHOT.pom
Abbadon
  • 2,513
  • 3
  • 25
  • 33
  • Can you post the build.gradle file from the module also (or at least the dependency section)? Thanks. – AndroidGuy Jan 25 '15 at 21:51
  • @AndroidGuy done. Is it correct to define the repositories in the parent only? I guess so... – Abbadon Jan 26 '15 at 06:54
  • Putting the repository at the parent level is the typical way to do it. The Android Studio wizards generate the build scripts that way. – AndroidGuy Jan 26 '15 at 17:33
  • Can you show that the library actually is in the local repository under the correct name? Maybe you could list the directory structure under ".m2". Is the library there? Or is the name of the library different than what the dependency expects? – AndroidGuy Jan 26 '15 at 17:38
  • Also, may I ask why you are putting the library directly in ".m2". I know that this isn't your question but I'm just curious. Thanks. – AndroidGuy Jan 26 '15 at 17:40
  • Are you sure that specifying a directory for a maven URL is supposed to work? Try this: http://stackoverflow.com/questions/21882804/adding-local-aar-files-to-my-gradle-build – Scott Barta Jan 26 '15 at 19:44
  • @Scott Barta I am pretty sure it is valid at least because I fill the value library in the Project settings in Intellij and he automatically create this line for me in the build.gradle file. – Abbadon Jan 27 '15 at 08:02
  • You might try looking at http://stackoverflow.com/a/20962300/990066 which seems to suggest that you may need a bit more setup to use maven local. – AndroidGuy Jan 27 '15 at 18:14

1 Answers1

0

path is not match Math/.m2 -> Math.m2

maven { url 'D:/Users/Math/.m2/repository' }

D:\Users\Math.m2\repository\com\poppy\tutti-frutti-dtos\1.0.0-SNAPSHOT
Jintin
  • 1,426
  • 13
  • 22