Gradle在本地存储库中找不到jar

时间:2014-05-02 10:27:25

标签: android gradle

使用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()甚至硬编码路径到存储库。

我对可能出现的问题没有任何线索了?

1 个答案:

答案 0 :(得分: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)

相关问题