我想使用FloatingActionButton
,但为此我需要库:
compile 'com.android.support:design:22.2.0'
但是当我把它添加到我的gradle中时,我收到了消息:
A problem occurred configuring project ':myModule'.
Could not resolve all dependencies for configuration ':myModule:_debugCompile'.
Could not find com.android.support:design:22.2.0.
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/design/22.2.0/design-22.2.0.pom
https://jcenter.bintray.com/com/android/support/design/22.2.0/design-22.2.0.jar
file:/D:/Development/Android/sdk/extras/android/m2repository/com/android/support/design/22.2.0/design-22.2.0.pom
file:/D:/Development/Android/sdk/extras/android/m2repository/com/android/support/design/22.2.0/design-22.2.0.jar
file:/D:/Development/Android/sdk/extras/google/m2repository/com/android/support/design/22.2.0/design-22.2.0.pom
file:/D:/Development/Android/sdk/extras/google/m2repository/com/android/support/design/22.2.0/design-22.2.0.jar
Required by:
myProject:myModule:unspecified
我尝试更新Android SDK,但所有内容都是最新的:
那么为什么com.android.support:design:22.2.0
无法解决?
这是我的傻瓜:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "de.bla.myProject"
minSdkVersion 19
targetSdkVersion 22
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
buildTypes {
debug {
debuggable true
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile project(':androidcircularcrop_lib')
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.google.android.gms:play-services:+'
compile 'com.android.support:design:22.2.0'
compile files('libs/eventbus-3.0.0-beta1.jar')
compile files('libs/mpandroidchartlibrary-2-1-0.jar')
compile files('libs/picasso-2.4.0.jar')
compile files('libs/YouTubeAndroidPlayerApi.jar')
}
答案 0 :(得分:2)
查看构建文件,始终设置target并将sdk编译为相同的数字。 appcompat lib也是sdk的一部分,因此当使用22.x.x支持lib时,你需要至少需要22个sdk以确保兼容性,更不用说找到lib了。 另外,Arkadiy建议使用与Android工作室兼容的最新构建工具和gradle版本。