【问题标题】:Local maven dependency not found by gradle in android studiogradle 在 android studio 中找不到本地 maven 依赖项
【发布时间】:2015-03-24 08:36:46
【问题描述】:

Android Studio 在我的本地存储库中找不到明显存在的依赖项。错误:

错误:找不到:com.poppy:tutti-frutti-dtos:1.0.0-SNAPSHOT 打开文件
在项目结构中打开 对话框

我正在使用 gradle 包装器和 Android Studio 1.0.2。我已经仔细检查了我的依赖项的名称,并且我有以下项目的 build.gradle 文件。我也尝试过 mavenLocale() 似乎也不起作用。有什么建议可以调试吗?

// 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' }
    }
}

这是我项目的模块 build.gradle 文件的依赖部分:

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.+'
}

我的图书馆位于:D:\Users\Math.m2\repository\com\poppy\tutti-frutti-dtos\1.0.0-SNAPSHOT 该文件夹下有四个文件:

  • _remote.repositories
  • maven-metadata-local.xml
  • tutti-frutti-dtos-1.0.0-SNAPSHOT.jar
  • tutti-frutti-dtos-1.0.0-SNAPSHOT.pom

【问题讨论】:

  • 你能从模块中发布 build.gradle 文件吗(或者至少是依赖部分)?谢谢。
  • @AndroidGuy 完成。仅在父级中定义存储库是否正确?我猜是……
  • 将存储库放在父级是典型的做法。 Android Studio 向导以这种方式生成构建脚本。
  • 您能否证明该库实际上以正确的名称位于本地存储库中?也许您可以列出“.m2”下的目录结构。图书馆在吗?还是库的名称与依赖项期望的不同?
  • 另外,请问您为什么将库直接放在“.m2”中。我知道这不是你的问题,但我只是好奇。谢谢。

标签: android maven android-studio android-gradle-plugin


【解决方案1】:

路径不匹配 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

【讨论】:

    猜你喜欢
    • 2015-09-16
    • 1970-01-01
    • 2021-02-02
    • 1970-01-01
    • 2023-04-11
    • 1970-01-01
    • 1970-01-01
    • 2013-12-09
    • 1970-01-01
    相关资源
    最近更新 更多