缺少与Gradle的依赖关系? [英] Missing Dependencies with Gradle?

查看:203
本文介绍了缺少与Gradle的依赖关系?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



老实说,我是一个Gradle的完全新手,所以我很喜欢这个工具, m
$ b

下面是我的gradle包装器的输出:

 开始构建
使用设置文件C:\ Users \Daniel\Projects\JustSingIt- Android\settings.gradle进行评估的设置。已加载
项目。使用构建文件C:\ Users \Daniel\Projects\JustSingIt-Android\build.gradle的根项目。
包含的项目:[root项目'JustSingIt-Android',项目':JustSingIt']
使用构建文件'C:\ Users'\\Daniel\Projects\\评估根项目'JustSingIt-Android' \\JustSingIt-Android\build.grad。
使用构建文件评估项目'JustSingIt'C:\ Users \Daniel\Projects\JustSingIt-Android\JustSingIt\build.gradl'
编译构建文件'C:\\ \\用户\\丹尼尔​​\项目\ JustSingIt- Android \JustSingIt\build.gradle'使用BuildScriptClasspathiptTransformer。
使用BuildScriptTransform

编译构建文件'C:\ Users \Daniel\Projects\JustSingIt -Android\JustSingIt\build.gradle'依靠打包来定义扩展的主神器已被弃用,并计划被删除Gradle 2.0
资源缺失。 [HTTP GET:http://repo1.maven.org/maven2/com/android/volley/volley/1.0/volley-1.0.pom]
缺少资源。 [HTTP HEAD:http://repo1.maven.org/maven2/com/android/volley/volley/1.0/volley-1.0.jar]
缺少资源。 [HTTP GET:http://repo1.maven.org/maven2/com/readystatesoftware/android-simpl3r/maven-metadata.xml]
缺少资源。 [HTTP GET:http://repo1.maven.org/maven2/com/readystatesoftware/android-simpl3r/]
缺少资源。 [HTTP GET:http://repo1.maven.org/maven2/com/readystatesoftware/android-simpl3r/maven-metadata.xml]
缺少资源。 [HTTP GET:http://repo1.maven.org/maven2/com/readystatesoftware/android-simpl3r/]
缺少资源。 [HTTP GET:http://repo1.maven.org/maven2/com/handmark/pulltorefresh/library/2.1.1/library-2.1.1.pom
缺少资源。 [HTTP HEAD:http://repo1.maven.org/maven2/com/handmark/pulltorefresh/library/2.1.1/library-2.1.1.ja
缺少资源。 [HTTP GET:http://repo1.maven.org/maven2/com/facebook/android/facebook-sdk/maven-metadata.xml]
缺少资源。 [HTTP GET:http://repo1.maven.org/maven2/com/facebook/android/facebook-sdk/]
缺少资源。 [HTTP GET:http://repo1.maven.org/maven2/com/facebook/android/facebook-sdk/maven-metadata.xml]
缺少资源。 [HTTP GET:http://repo1.maven.org/maven2/com/facebook/android/facebook-sdk/]

失败:生成失败,出现异常。

*出错:
配置项目'JustSingIt'出现问题。
>无法解析配置的所有依赖关系:JustSingIt:_debugCompile。
>找不到com.android.volley:volley:1.0。
要求:
JustSingIt-Android:JustSingIt:未指定
>找不到与com.readystatesoftware匹配的任何版本:android-simpl3r:1.0+。
要求:
JustSingIt-Android:JustSingIt:未指定
>找不到com.handmark.pulltorefresh:library:2.1.1。
要求:
JustSingIt-Android:JustSingIt:未指定
>找不到与com.facebook.android:facebook-sdk:0.1+匹配的任何版本。
要求:
JustSingIt -Android:JustSingIt:未指定

*尝试:
使用--stacktrace选项运行以获取堆栈跟踪。使用--debug选项运行以获取更多日志输出。

以下是我的gradle文件:

<$ p



$ mavenCentral()
mavenLocal()
}

依赖关系{
classpath'com.android.tools.build:gradle:0.7+'
classpath'com.newrelic.agent.android:agent-gradle-plugin:2.433.0'
}
}
apply plugin:'android'
// apply plugin:'newrelic'

repositories {
mavenCentral()
mavenLocal()
}

android {
compileSdkVersion 18
buildToolsVersion '19 .0.1'

defaultConfig {
minSdkVersion 14
targetSdkVersion 19

buildConfigFieldboolean,ACRA_ENABLE,'true'
buildConfigFieldboolean,API_FAKE_ENABLE,'true'
}

buildTypes {
阶段{
版本名称
versionNameSuffix'S'
debuggable true
packageNameSuffix'.stage'


dev {
versionNameSuffix'D'
debuggable true
packageNameSuffix'。 dev'
}
release {
debuggable true
}

}

依赖关系{
repositories()
编译fileTree(dir:'libs',包括'* .jar')

// Google Play服务
编译'com.google.android.gms:play-服务:3.2+'

compile'c​​om.android.volley:volley:1.0'

compile'c​​om.squareup:otto:1.3+'

compile('com.google.code.gson:gson:2.2+'){
exclude group:'org.json'
}

compile'c​​om.googlecode .libphonenumber:libphonenumber:3.1+'

compile'c​​h.acra:acra:4.5+'

compile'c​​om.squareup.okh ttp:okhttp:1.2+'
compile'c​​om.jakewharton:butterknife:3.0+'
compile'c​​om.android.support:appcompat-v7:18.0.0'
compile'c​​om。 readystatesoftware:android-simpl3r:1.0+'

// New Relic removed。
// compile'c​​om.newrelic.agent.android:android-agent:2.433.0'


// compile'c​​om.origamilabs.library:StaggeredGridView:1.0+ '
compile'net.hockeyapp.android:HockeySDK:3.0.1'

compile(com.handmark.pulltorefresh:library:2.1.1){
exclude group :'com.android.support'
}

compile('com.facebook.android:facebook-sdk:0.1+'){
exclude group:'com.android .support'
}
}
}

有什么想法?谢谢!



编辑:新问题



好了,现在问题是在构建(.\gradlew构建)期间,我收到了很多与类路径中找不到的这些库相关的错误。我还手动将Amazon AWS SDK添加到项目中,但我遇到了同样的错误。看起来正确安装的唯一库是Facebook。



这是我最新的build.gradle:

<$ p $
存储库{
mavenCentral()
mavenLocal()
}

依赖关系{
classpath 'com.android.tools.build:gradle:0.7+'
classpath'com.newrelic.agent.android:agent-gradle-plugin:2.433.0'
}
}
apply plugin:'android'
// apply plugin:'newrelic'

repositories {
mavenCentral()
mavenLocal()
}

android {
compileSdkVersion 18
buildToolsVersion '19 .0.1'

defaultConfig {
minSdkVersion 14
targetSdkVersion 19

buildConfigFieldboolean,ACRA_ENABLE,'true'
buildConfigFieldboolean,API_FAKE_ENABLE,'true'
}

buildTypes {
st年龄{
versionName
versionNameSuffix'S'
可调试真实
packageNameSuffix'.stage'


dev {
versionNameSuffix 'D'
debuggable true
packageNameSuffix'.dev'
}
release {
debuggable true
}

}

dependencies {
repositories()
编译fileTree(dir:'libs',include:'* .jar')
编译fileTree(dir:'libraries',包括:'* .jar')
编译项目(':libraries:facebook')
编译'com.google.android.gms:play-services:3.2+'// Google Play Services
compile'c​​om.mcxiaoke.volley:library:1.0+'//< - Volley-Mirror,volley的镜像,
compile'c​​om.squareup:otto:1.3+'
compile' com.googlecode.libphone编号:libphonenumber:3.1+'
编译'ch.acra:acra:4.5+'
编译'com.squareup.okhttp:okhttp:1.2+'
compile'c​​om.jakewharton:butterknife :3.0+'
compile'c​​om.android.support:appcompat-v7:18.0.0'
compile'c​​om.github.manuelpeinado.refreshactionitem:library:1.0+'
compile'net .hockeyapp.android:HockeySDK:3.0.1'
compile('com.google.code.gson:gson:2.2+'){
exclude group:'org.json'
}
compile('com.github.chrisbanes.pulltorefresh:parent:2.1+'){
exclude group:'com.android.support'
}

/ / New Relic删除。
// compile'c​​om.newrelic.agent.android:android-agent:2.433.0'

// compile'c​​om.origamilabs.library:StaggeredGridView:1.0+'

// compile('com.facebook.android:facebook-sdk:0.1+'){
// exclude group:'com.android.support'
//}



解决方案

在Maven中央存储库中可用。有时候,您必须将其他存储库添加到您的构建中,或者自己构建项目并将其发布到本地Maven回购站。 $ b

com.android.volley code> - 在Maven Central中不可用,但您可以自己构建它并推送到本地Maven存储库或使用 volley-mirror 项目,发布到Maven Central。

com.facebook.android - 您必须安装它才能在您的项目中使用。说明可在此处 a>。

com.handmark.pulltorefresh - 它在 com.github.chrisbanes.pulltorefresh

com.readystatesoftware.android-simpl3r - 同上,它发布到Maven Central的 com.github.manuelpeinado.refreshactionitem


I'm bootstrapping for an Android project, which seems to be managed with Gradle.

To be honest I'm a complete newb with Gradle, so I'm slowly gearing up.

Here's the output of my gradle wrapper:

C:\Users\Daniel\Projects\JustSingIt-Android [feature/no-newrelic +0 ~1 -0]> .\gradlew --info
Starting Build
Settings evaluated using settings file 'C:\Users\Daniel\Projects\JustSingIt-    Android\settings.gradle'.
Projects loaded. Root project using build file 'C:\Users\Daniel\Projects\JustSingIt-Android\build.gradle'.
Included projects: [root project 'JustSingIt-Android', project ':JustSingIt']
Evaluating root project 'JustSingIt-Android' using build file 'C:\Users\Daniel\Projects\JustSingIt-Android\build.grad'.
Evaluating project ':JustSingIt' using build file 'C:\Users\Daniel\Projects\JustSingIt-Android\JustSingIt\build.gradl'
Compiling build file 'C:\Users\Daniel\Projects\JustSingIt-  Android\JustSingIt\build.gradle' using BuildScriptClasspathiptTransformer.
Compiling build file 'C:\Users\Daniel\Projects\JustSingIt-Android\JustSingIt\build.gradle' using BuildScriptTransform

Relying on packaging to define the extension of the main artifact has been deprecated and is scheduled to be removed Gradle 2.0
Resource missing. [HTTP GET: http://repo1.maven.org/maven2/com/android/volley/volley/1.0/volley-1.0.pom]
Resource missing. [HTTP HEAD: http://repo1.maven.org/maven2/com/android/volley/volley/1.0/volley-1.0.jar]
Resource missing. [HTTP GET: http://repo1.maven.org/maven2/com/readystatesoftware/android-simpl3r/maven-metadata.xml]
Resource missing. [HTTP GET: http://repo1.maven.org/maven2/com/readystatesoftware/android-simpl3r/]
Resource missing. [HTTP GET: http://repo1.maven.org/maven2/com/readystatesoftware/android-simpl3r/maven-metadata.xml]
Resource missing. [HTTP GET: http://repo1.maven.org/maven2/com/readystatesoftware/android-simpl3r/]
Resource missing. [HTTP GET: http://repo1.maven.org/maven2/com/handmark/pulltorefresh/library/2.1.1/library-2.1.1.pom
Resource missing. [HTTP HEAD: http://repo1.maven.org/maven2/com/handmark/pulltorefresh/library/2.1.1/library-2.1.1.ja
Resource missing. [HTTP GET: http://repo1.maven.org/maven2/com/facebook/android/facebook-sdk/maven-metadata.xml]
Resource missing. [HTTP GET: http://repo1.maven.org/maven2/com/facebook/android/facebook-sdk/]
Resource missing. [HTTP GET: http://repo1.maven.org/maven2/com/facebook/android/facebook-sdk/maven-metadata.xml]
Resource missing. [HTTP GET: http://repo1.maven.org/maven2/com/facebook/android/facebook-sdk/]

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':JustSingIt'.
> Could not resolve all dependencies for configuration ':JustSingIt:_debugCompile'.
   > Could not find com.android.volley:volley:1.0.
     Required by:
         JustSingIt-Android:JustSingIt:unspecified
   > Could not find any version that matches com.readystatesoftware:android-simpl3r:1.0+.
     Required by:
         JustSingIt-Android:JustSingIt:unspecified
   > Could not find com.handmark.pulltorefresh:library:2.1.1.
     Required by:
         JustSingIt-Android:JustSingIt:unspecified
   > Could not find any version that matches com.facebook.android:facebook-sdk:0.1+.
     Required by:
         JustSingIt-Android:JustSingIt:unspecified

* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output.

And here's my gradle file:

buildscript {
    repositories {
        mavenCentral()
        mavenLocal()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:0.7+'
        classpath 'com.newrelic.agent.android:agent-gradle-plugin:2.433.0'
    }
}
apply plugin: 'android'
//apply plugin: 'newrelic'

repositories {
    mavenCentral()
    mavenLocal()
}

android {
    compileSdkVersion 18
    buildToolsVersion '19.0.1'

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 19

        buildConfigField "boolean", "ACRA_ENABLE", 'true'
        buildConfigField "boolean", "API_FAKE_ENABLE", 'true'
    }

    buildTypes {
        stage {
            versionName
            versionNameSuffix 'S'
            debuggable true
            packageNameSuffix '.stage'

        }
        dev {
            versionNameSuffix 'D'
            debuggable true
            packageNameSuffix '.dev'
        }
        release {
            debuggable true
    }

}

dependencies {
        repositories()
        compile fileTree(dir: 'libs', include: '*.jar')

        // Google Play Services
        compile 'com.google.android.gms:play-services:3.2+'

        compile 'com.android.volley:volley:1.0'

        compile 'com.squareup:otto:1.3+'

        compile('com.google.code.gson:gson:2.2+') {
            exclude group: 'org.json'
        }

        compile 'com.googlecode.libphonenumber:libphonenumber:3.1+'

        compile 'ch.acra:acra:4.5+'

        compile 'com.squareup.okhttp:okhttp:1.2+'
        compile 'com.jakewharton:butterknife:3.0+'
        compile 'com.android.support:appcompat-v7:18.0.0'
        compile 'com.readystatesoftware:android-simpl3r:1.0+'

       // New Relic removed.
      //  compile 'com.newrelic.agent.android:android-agent:2.433.0'


//        compile 'com.origamilabs.library:StaggeredGridView:1.0+'
        compile 'net.hockeyapp.android:HockeySDK:3.0.1'

        compile("com.handmark.pulltorefresh:library:2.1.1") {
            exclude group: 'com.android.support'
        }

        compile('com.facebook.android:facebook-sdk:0.1+') {
            exclude group: 'com.android.support'
        }
    }
}

Any ideas? Thanks!

EDIT : New Issue

OK so now the problem is that during build (.\gradlew build) I'm getting a lot of errors related to these libraries not found in the classpath. I also added the Amazon AWS SDK to the project manually, but I'm getting the same errors. The only library that seems to be correctly installed is Facebook.

Here's my latest build.gradle:

buildscript {
    repositories {
        mavenCentral()
        mavenLocal()
    }    

    dependencies {
        classpath 'com.android.tools.build:gradle:0.7+'
        classpath 'com.newrelic.agent.android:agent-gradle-plugin:2.433.0'
    }
}
apply plugin: 'android'
//apply plugin: 'newrelic'    

repositories {
    mavenCentral()
    mavenLocal()
}    

android {
    compileSdkVersion 18
    buildToolsVersion '19.0.1'    

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 19    

        buildConfigField "boolean", "ACRA_ENABLE", 'true'
        buildConfigField "boolean", "API_FAKE_ENABLE", 'true'
    }    

    buildTypes {
        stage {
            versionName
            versionNameSuffix 'S'
            debuggable true
            packageNameSuffix '.stage'    

        }
        dev {
            versionNameSuffix 'D'
            debuggable true
            packageNameSuffix '.dev'
        }
        release {
            debuggable true
    }    

}    

dependencies {
        repositories()
        compile fileTree(dir: 'libs', include: '*.jar')
        compile fileTree(dir: 'libraries', include: '*.jar')
        compile project(':libraries:facebook')
        compile 'com.google.android.gms:play-services:3.2+'         // Google Play Services
        compile 'com.mcxiaoke.volley:library:1.0+'                  // <- Volley-Mirror, a mirror of volley,
        compile 'com.squareup:otto:1.3+'
        compile 'com.googlecode.libphonenumber:libphonenumber:3.1+'
        compile 'ch.acra:acra:4.5+'
        compile 'com.squareup.okhttp:okhttp:1.2+'
        compile 'com.jakewharton:butterknife:3.0+'
        compile 'com.android.support:appcompat-v7:18.0.0'
        compile 'com.github.manuelpeinado.refreshactionitem:library:1.0+'
        compile 'net.hockeyapp.android:HockeySDK:3.0.1'
        compile('com.google.code.gson:gson:2.2+') {
            exclude group: 'org.json'
        }
        compile('com.github.chrisbanes.pulltorefresh:parent:2.1+') {
            exclude group: 'com.android.support'
        }    

    // New Relic removed.
//        compile 'com.newrelic.agent.android:android-agent:2.433.0'    

//        compile 'com.origamilabs.library:StaggeredGridView:1.0+'    

//        compile('com.facebook.android:facebook-sdk:0.1+') {
//            exclude group: 'com.android.support'
//        }
    }
}

解决方案

Not every library is available in Maven Central repository. Sometimes you have to add other repositories to your build or build the project yourself and publish to local Maven repo.

com.android.volley - is not available in Maven Central, but you can either build it yourself and push to local Maven repository or use volley-mirror project, which is published to Maven Central.

com.facebook.android - you have to install it to use in your project. Instructions are available here.

com.handmark.pulltorefresh - it is published to Maven Central under com.github.chrisbanes.pulltorefresh

com.readystatesoftware.android-simpl3r - same as above, it is published to Maven Central under com.github.manuelpeinado.refreshactionitem

这篇关于缺少与Gradle的依赖关系?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆