当我在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:'
}
答案 0 :(得分:1)
错误:强>
错误:配置项目':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
}
答案 1 :(得分:0)
你忘记了版本吗?在你的gradle配置中你应该有这样的东西:
compile 'com.android.support:recyclerview-v7:23.0.1'
答案 2 :(得分:0)
就我而言,我删除了custom background
文件夹内的<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp">
<LinearLayout
android:id="@+id/customLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/card_round_corner"
android:orientation="vertical">
</LinearLayout>
</RelativeLayout>
文件夹,然后添加了caches
。它对我有用!