【发布时间】:2017-03-22 01:39:52
【问题描述】:
我已经浪费了一整天,而且离解决方案还很远。
今天早上,我决定添加 LeakCanary 来检查我们正在开发的 android 应用程序中的泄漏。我通常在离线模式下工作,因为它可以加快构建速度。将其添加为依赖项后,我禁用了离线模式。
在一分钟内我收到一条错误消息 -
Failed to resolve: com.android.support:appcompat-v7:25.0.0
目前,我们正在与 -
- 编译SdkVersion 23
- buildToolsVersion "23.0.3"
我们所有的 android 支持库,包括 v4 和 v7,都使用 23.1.1
所以我想也许 LeakCanary 库内部使用 25.0.0,所以我从 build.gradle 中删除了该库。
但错误仍然存在。
我试过了——
- 关闭并重新启动 Android Studio。
- 在 AS 中关闭并重新打开项目。
- 使缓存失效并重新启动 AS。
- 干净的构建。
实际上,我的代码与昨天正确构建和运行时的代码完全相同,但今天它似乎并没有运行。
可能是什么问题?
编辑
这里是 build.gradle -
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
repositories {
maven {
url "http://repo1.maven.org/maven2"
}
useLibrary 'org.apache.http.legacy'
}
defaultConfig {
applicationId "com.example.pc.vision_test"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
multiDexEnabled true
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(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile files('libs/YouTubeAndroidPlayerApi.jar')
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.ogaclejapan.smarttablayout:library:1.6.1@aar'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.google.apis:google-api-services-youtube:v3-rev149-1.20.0'
compile 'com.google.http-client:google-http-client-android:1.20.0'
compile 'com.google.api-client:google-api-client-android:1.20.0'
compile 'com.google.api-client:google-api-client-gson:1.20.0'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
compile 'com.google.android.gms:play-services-auth:8.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile 'com.google.android.gms:play-services-appindexing:8.4.0'
compile 'com.amazonaws:aws-android-sdk-core:2.+'
compile 'com.amazonaws:aws-android-sdk-cognito:2.+'
compile 'com.amazonaws:aws-android-sdk-s3:2.+'
compile 'com.android.support:multidex:1.0.1'
compile 'commons-io:commons-io:2.4'
compile 'com.github.PhilJay:MPAndroidChart:v2.2.5'
compile 'com.squareup.okhttp:okhttp:2.5.0'
compile 'com.google.android.gms:play-services-maps:8.4.0'
compile 'com.google.maps.android:android-maps-utils:0.3+'
compile 'com.android.support:palette-v7:23.1.1'
compile 'com.github.shazrazdan:Elemento:0.9.7@aar'
compile 'com.afollestad.material-dialogs:core:0.8.6.1'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.github.bmarrdev:android-DecoView-charting:v1.2'
compile 'com.vimeo.networking:vimeo-networking:1.0.1'
compile 'com.roomorama:caldroid:3.0.1'
compile 'org.apache:pdfbox-android:1.8.9.0'
compile 'com.android.support:customtabs:23.1.1'
}
apply plugin: 'com.google.gms.google-services'
【问题讨论】:
-
你可以发布你的 gradle 吗?
-
虽然unable to resolve com.android.support…25.0.0check 可能会对你有所帮助
-
是的,我的问题类似。但我现在不想更新。
-
原因是您新添加的库正在使用此库 (25.0.0)。您可以尝试使用以前版本的库,看看他们是否使用较低版本的支持库。但正确的解决方案是针对最新的SDK并支持库。
-
我在问题中提到我删除了库,但问题仍然存在。
标签: android build.gradle