当我在android studio中运行我的应用程序时出现错误。我是android开发的新手。

我的Logtag在这里:

        Information:Gradle tasks [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:assembleDebug]
    Error:A problem occurred configuring project ':app'.
    > Could not resolve all dependencies for configuration ':app:_debugCompile'.
    > Could not find com.android.support:recyclerview-v7:.
     Searched in the following locations:
         https://jcenter.bintray.com/com/android/support/recyclerview-v7//recyclerview-v7-.pom
         https://jcenter.bintray.com/com/android/support/recyclerview-v7//recyclerview-v7-.jar
         file:/C:/Users/ANDROID/AppData/Local/Android/sdk/extras/android/m2repository/com/android/support/recyclerview-v7//recyclerview-v7-.pom
         file:/C:/Users/ANDROID/AppData/Local/Android/sdk/extras/android/m2repository/com/android/support/recyclerview-v7//recyclerview-v7-.jar
         file:/C:/Users/ANDROID/AppData/Local/Android/sdk/extras/google/m2repository/com/android/support/recyclerview-v7//recyclerview-v7-.pom
         file:/C:/Users/ANDROID/AppData/Local/Android/sdk/extras/google/m2repository/com/android/support/recyclerview-v7//recyclerview-v7-.jar
     Required by:
         ShoppingMazza:app:unspecified
    Information:BUILD FAILED
    Information:Total time: 4.964 secs
    Information:1 error
    Information:0 warnings
    Information:See complete output in console


我的build.gradle

apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "23.0.1"

defaultConfig {
    applicationId "com.catalyst.android.shoppingmazza"
    minSdkVersion 16
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
packagingOptions {
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/NOTICE.txt'
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
compile 'com.squareup.picasso:picasso:2.3.2'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.daimajia.slider:library:1.1.5@aar'
compile 'com.android.support:recyclerview-v7:'
}

最佳答案

错误:


  错误:配置项目':app'时发生问题。不能
  解析配置':app:_debugCompile'的所有依赖项。
  找不到com.android.support:recyclerview-v7:。


由于错误,我可以说您必须添加以下gradle依赖项:

compile 'com.android.support:recyclerview-v7:+'


编辑:


  错误:任务':app:dexDebug'的执行失败。 >
  com.android.ide.common.process.ProcessException:
  org.gradle.process.internal.ExecException:处理'命令
  C:\ Program Files \ Java \ jdk1.8.0_51 \ bin \ java.exe完成
  非零退出值1


对于这个错误,我认为您正在编译JAR库两次。您正在使用

compile fileTree(dir: 'libs', include: ['*.jar'])


build.gradle文件中,因此它将编译libs文件夹上具有jar扩展名的所有库,因此您可以删除以下行:

compile 'com.squareup.picasso:picasso:2.3.2'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.daimajia.slider:library:1.1.5@aar'


如果问题仍然存在,则问题很可能是由于超过了Android规定的65K方法dex限制。可以通过清理项目并从build.gradle中的依赖项中删除一些未使用的库和方法来解决此问题,或者通过添加multidex支持来解决此问题。

defaultConfig {
    // Enabling multidex support.
    multiDexEnabled true
}

关于android - 无法解析配置':app:_debugCompile'的所有依赖项。在android studio中,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/33099133/

10-12 00:20
查看更多