我正在尝试导入两个android支持库。我正在尝试将GoogleMaps AP2应用到我的Android应用程序中。因此我需要两个库。我正在使用AndroidStudio和Gradle。
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
apt "org.androidannotations:androidannotations:$AAVersion"
compile "org.androidannotations:androidannotations-api:$AAVersion"
compile 'com.android.support:appcompat-v7:21.0.+'
// compile 'com.google.android.gms:play-services:6.1.+'
compile "com.android.support:support-v13:18.0.+"
compile "com.loopj.android:android-async-http:1.4.5"
repositories {
mavenCentral()
}
compile "com.github.chrisbanes.actionbarpulltorefresh:library:+"
compile 'joda-time:joda-time:2.5'
}
错误是:
Module version com.android.support:support-v13:18.0.0 depends on libraries but is not a library itself
答案 0 :(得分:30)
您必须使用最新版本的support-v13:21.0。+
您遇到此错误,因为appcompat和support-v13都依赖于support-v4,并且它们是版本冲突。
顺便说一下,这不是最好的错误。
答案 1 :(得分:3)
最后,这段代码对我有用:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
apt "org.androidannotations:androidannotations:$AAVersion"
compile "org.androidannotations:androidannotations-api:$AAVersion"
compile 'com.android.support:support-v4:20.0.+'
compile "com.android.support:appcompat-v7:20.0.+"
compile "com.android.support:support-v13:20.0.+"
compile 'com.google.android.gms:play-services:6.1.+'
compile "com.loopj.android:android-async-http:1.4.5"
repositories {
mavenCentral()
}
compile "com.github.chrisbanes.actionbarpulltorefresh:library:+"
compile 'joda-time:joda-time:2.5'
}
答案 2 :(得分:1)
我遇到了类似的问题,发现https://code.google.com/p/android/issues/detail?id=73802:' support-v13:19.1.0库的元数据不正确,可能是因为从JAR切换到AAR '
我尝试使用一堆不同的组合构建并找到以下内容:
1)如果使用support-v13< support-v13:20.0.0,所有其他支持库也必须在20.0.0之前
2)如果使用support-v13> = support-v13:20.0.0,其他支持库可以是任何版本。
示例:
support-v13< support-v13:20.0.0,其他支持库> = 20.0.0
implementation 'com.android.support:support-v4:22.0.0'
implementation 'com.android.support:appcompat-v7:22.0.0'
implementation 'com.android.support:support-v13:19.0.0'
错误:模块版本com.android.support:support-v13:19.0.0依赖于库但不是库本身
support-v13< support-v13:20.0.0与其他支持库< 20.0.0
implementation 'com.android.support:support-v4:19.0.0'
implementation 'com.android.support:appcompat-v7:19.0.0'
implementation 'com.android.support:support-v13:19.0.0'
构建良好的
support-v13> = support-v13:20.0.0
implementation 'com.android.support:support-v4:13.0.0'
implementation 'com.android.support:appcompat-v7:22.0.0'
implementation 'com.android.support:support-v13:20.0.0'
构建良好的
因此,请确保support-v13至少支持-v13:20.0.0或更高版本。
答案 3 :(得分:0)
删除行:compile 'com.android.support:appcompat-v7:21.0.+'
答案 4 :(得分:0)
对于v13,添加compileSdkVersion 21,targetSdkVersion 21,并编译" com.android.support:support-v13:21.0。+" 您可能不会评论“com.android.support:appcompat-v7:21.0.3'”,这应该可行 我的gradle样本
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "someId"
minSdkVersion 11
targetSdkVersion 21
versionCode 5
versionName "1.1"
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.google.android.gms:play-services:6.5.87'
compile "com.android.support:support-v13:21.0.+"
}