我找到了很多关于这个问题的帖子,但是没有一个关于这个问题的帖子。这是我的Gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "*********"
minSdkVersion 16
targetSdkVersion 23
versionCode 5
versionName "1.1"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.android.support:cardview-v7:21.0.+'
compile 'com.android.support:recyclerview-v7:21.0.+'
compile files('libs/gradle-wrapper.jar')
compile 'com.facebook.fresco:fresco:0.9.0+'
compile 'com.facebook.android:audience-network-sdk:4.+'
compile 'com.google.android.gms:play-services:7.8.0'
}
我无法弄清楚问题所在。
答案 0 :(得分:2)
您可以将其视为树:
gradle -q dependencies yourProject:dependencies --configuration compile
或在Windows上,使用gradlew
gradlew -q dependencies yourProject:dependencies --configuration compile
示例输出:
compile - Classpath for compiling the main sources.
+--- org.androidannotations:androidannotations-api:3.2
+--- com.android.support:support-annotations:22.1.1
+--- com.squareup:otto:1.3.6
+--- in.srain.cube:grid-view-with-header-footer:1.0.10
+--- com.nostra13.universalimageloader:universal-image-loader:1.9.3
+--- com.github.chrisbanes.photoview:library:1.2.3
+--- org.simpleframework:simple-xml:2.7.1
+--- com.google.android.gms:play-services-base:6.5.+ -> 6.5.87
+--- project :yourProject
| +--- com.loopj.android:android-async-http:1.4.6
| +--- org.apache.httpcomponents:httpmime:4.2.5
| | \--- org.apache.httpcomponents:httpcore:4.2.4
| \--- com.google.code.gson:gson:2.3.1
+--- project :facebook
| \--- com.android.support:appcompat-v7:22.1.1
| \--- com.android.support:support-v4:22.1.1
| \--- com.android.support:support-annotations:22.1.1 -> 22.2.0
为避免重复,请在每个项目exclude
build.gradle
compile('com.github.chrisbanes.photoview:library:1.2.3') {
exclude group: 'com.android.support'
}
compile('org.simpleframework:simple-xml:2.7.1') {
exclude module: 'stax'
exclude module: 'stax-api'
exclude module: 'xpp3'
}
compile('com.google.android.gms:play-services-base:6.5.+')
{
exclude module: 'support-v4'
}
答案 1 :(得分:0)
首先,您应该为支持库使用相同的支持版本(appcompat,cardview,recyclerview) 您也可以尝试将fresco更新到当前版本(0.11.0)以检查是否可以解决问题。 还要避免在依赖项中使用“+”,因为它只是一种不好的做法,可能导致意外行为。
答案 2 :(得分:0)
尝试更新到最新的play-services
库:
compile 'com.google.android.gms:play-services:9.2.0'
在任何情况下,您都应该尝试仅添加所需的依赖项,例如:
com.google.android.gms:play-services-analytics:9.2.0
com.google.android.gms:play-services-maps:9.2.0
检查bottom of the following link以查看有关解耦依赖关系的更多信息。