【问题标题】:Gradle does not find jar in local repositoryGradle 在本地存储库中找不到 jar
【发布时间】:2014-05-02 10:27:24
【问题描述】:

使用 Android Studio 0.4.6

我有以下 gradle.build 文件:

应用插件:'android'

buildscript {
    repositories {
        mavenCentral()
        mavenLocal()
    }
}

android {
    compileSdkVersion 19
    buildToolsVersion "19.0.3"

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile 'com.android.support:support-v4:19.0.0'
    compile 'com.my.products.aproduct:aproduct.sdk.java:1.0.1-SNAPSHOT'
    compile fileTree(dir: 'libs', include: ['*.jar'])
}

构建项目时找不到jar:

* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
   > Could not find com.my.products.aproduct:aproduct.sdk.java:1.0.1-SNAPSHOT.
     Required by:
         sva.frontend.android.jpurse:app:unspecified

虽然我可以在本地存储库 (~/.m2) 文件夹中找到 jar 和 pom 文件。我检查了 android studio 的 maven 设置,他们添加了一个指向 ~/.m2/repositories 的本地存储库

我还尝试在我的 gradle 文件中添加 mavenLocal() 甚至是存储库的硬编码路径。

我不知道可能出了什么问题?

【问题讨论】:

    标签: android gradle


    【解决方案1】:

    你把mavenLocal()放错地方了。

    buildscript {
        repositories {
            mavenCentral()        
        }
         dependencies {
            //use your version
            classpath 'com.android.tools.build:gradle:0.9.+'        
        }
    }
    
    apply plugin: 'android'
    
    repositories {
        mavenCentral()
        mavenLocal()
    }
    

    另外我建议您将您的 AS 版本更新到最新版本 (0.5.7)

    【讨论】:

      猜你喜欢
      • 2018-05-23
      • 1970-01-01
      • 2011-02-04
      • 1970-01-01
      • 2016-04-17
      • 1970-01-01
      • 1970-01-01
      • 2019-01-17
      • 1970-01-01
      相关资源
      最近更新 更多