Could not resolve all dependencies for configuration ':app:_debugCompile'. in android studio

匿名 (未验证) 提交于 2019-12-03 09:06:55

问题:

When I am run my application in android studio error. I am new in android developing.

My Logtag is here:

        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 

My 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:' } 

I am new in android developing, please help.

Thank you very much for your time and assistance in this matter.

回答1:

Error:

Error:A problem occurred configuring project ':app'. Could not resolve all dependencies for configuration ':app:_debugCompile'.
Could not find com.android.support:recyclerview-v7:.

From error i can say you'll have to add the following gradle dependency :

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

EDIT:

Error:Execution failed for task ':app:dexDebug'. > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_51\bin\java.exe'' finished with non-zero exit value 1

For this error i think you are compiling JAR library twice. You are using

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

in build.gradle file so it will compile all library that has jar extension on libs folder, so You can remove this lines:

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

If issue still exists then issue is quite possibly due to exceeding the 65K methods dex limit imposed by Android. This problem can be solved either by cleaning the project, and removing some unused libraries and methods from dependencies in build.gradle, OR by adding multidex support.

defaultConfig {             // Enabling multidex support.     multiDexEnabled true } 


回答2:

Did you forget the version? In your gradle config you should have something like this:

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


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!