Gradle 构建工具找不到播放服务-tasks.aar?为什么?
Gradle build tool cannot find play-services-tasks.aar? Why?
今天突然,我在 Android studio 中尝试 运行 我的应用程序时出现错误。
是:
Error: Could not find play-services-tasks.aar (com.google.android.gms:play-services-tasks:15.0.1).
Searched in the following locations:
https://jcenter.bintray.com/com/google/android/gms/play-services-tasks/15.0.1/play-services-tasks-15.0.1.aar
我没有在gradle 文件中更改任何内容,但它突然出现了。我之前的构建在几分钟前成功执行。
为什么它找不到 play-services-tasks.aar
是 com.google.android.gms 的一部分:play-services-tasks:15.0.1
采取的步数:
我检查了我是否在 gradle 文件中包含了所有存储库,到目前为止都是正确的。
为什么突然出现这个错误?
我也将此 link https://jcenter.bintray.com/com/google/android/gms/play-services-tasks/15.0.1/play-services-tasks-15.0.1.aar 复制到浏览器中,但它工作正常,也就是说,我得到了 "File Download" 对话框。
我的 Gradle 文件
应用级别
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "mekanic24assistantapplication.heba.mekanic24.com.mekanic24assistantapplication"
minSdkVersion 14
targetSdkVersion 26
versionCode 13
versionName "2.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
incremental true
javaMaxHeapSize "4g"
}
// err Android Gradle Duplicate files copied in APK META-INF/license.txt
configurations.all {
resolutionStrategy {
force 'com.android.support:support-v4:26+'
force 'com.android.support:support-annotations:26+'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
// compile 'com.android.support:appcompat-v7:26.3.1'
compile 'com.android.support:appcompat-v7:26+'
compile 'com.android.support:design:26+'
compile 'com.android.support:recyclerview-v7:26+'
compile 'com.android.support:cardview-v7:26+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
androidTestCompile 'com.android.support:support-annotations:26+'
testCompile 'junit:junit:4.12'
// compile 'com.android.support:appcompat-v7:26.3.1'
compile 'com.github.markushi:circlebutton:1.1'
// compile 'com.android.support:design:26.3.1'
compile 'com.android.volley:volley:1.0.0'
compile 'com.google.android.gms:play-services-base:15.0.1'
compile 'com.android.support:multidex:1.0.1'
compile 'com.firebase:firebase-client-android:2.5.2'
compile 'com.google.firebase:firebase-core:15.0.2'
compile 'com.google.firebase:firebase-messaging:15.0.2'
compile 'com.google.firebase:firebase-database:15.0.0'
compile 'com.wang.avi:library:2.1.3'
compile 'de.hdodenhof:circleimageview:2.2.0'
compile 'android.lib.recaptcha:reCAPTCHA:2.0.0'
compile 'com.google.android.gms:play-services-safetynet:15.0.1'
compile 'com.google.android.gms:play-services-maps:15.0.1'
compile 'com.google.android.gms:play-services-places:15.0.1'
compile 'com.google.android.gms:play-services-location:15.0.1'
compile 'com.squareup.picasso:picasso:2.5.2'
testCompile 'junit:junit:4.12'
compile 'com.anjlab.android.iab.v3:library:1.0.38'
compile files('libs/mail.jar')
compile files('libs/additionnal.jar')
compile files('libs/activation.jar')
compile 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
compile 'com.yarolegovich:lovely-dialog:1.1.0'
compile 'com.mobsandgeeks:android-saripaar:2.0.3'
compile 'com.github.stfalcon:smsverifycatcher:0.3.1'
compile 'ch.acra:acra:4.9.0'
//TODO: Apache 2.0 license https://github.com/ACRA/acra
compile 'com.google.android.gms:play-services-ads:15.0.1'
compile 'com.github.luongvo:GmailBackground:2.0.2'
}
apply plugin: 'com.google.gms.google-services'
项目级别
buildscript {
repositories {
jcenter()
maven { url 'https://maven.google.com' }
maven {
url "https://dl.bintray.com/android/android-tools"
}
maven { url "https://jitpack.io" }
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.2'
classpath 'com.google.gms:google-services:3.2.0'
}
}
allprojects {
repositories {
jcenter()
maven { url 'https://maven.google.com' }
maven {
url "https://dl.bintray.com/android/android-tools"
}
maven { url "https://jitpack.io" }
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
我今天遇到了同样的问题。到现在为止一切正常。可能是暂时的 Google 服务器问题。
对我有用的解决方案是使用旧版本的 google-play-services:
implementation 'com.google.android.gms:play-services-maps:11.4.2'
难道是google改变了服务端包的命名约定?
我刚才在使用不同的播放服务包时遇到了同样的问题。
即play-services-basement.aar...
我认为
Could not find play-services-tasks.aar
表示它正在寻找名为 play-services-tasks.aar
的文件
在服务器上这个文件被调用:
play-services-tasks-15.0.1.aar
我认为这是文件未正确命名的 gradle 问题或文件未正确命名的服务器端问题。
如有错误请指正
编辑:这个问题应该报告给 jcenter.bintray.com 因为他们是他们服务器端的错误。切换到 Ivan Rigamonti 提到的 Maven 存储库可能是一个解决方案,但我不确定离子应用程序如何处理切换存储库。
EDIT2:切换到 maven 存储库确实适用于 ionic。对于 ionic,我所要做的就是通过将 jcenter() 放在 buildscript 存储库和 allprojects 存储库中的 maven() 下面来改变 build.gradle。
进行以下更改后,错误消失了:
- 已从应用 build.gradle 的存储库中删除
maven { url 'https://maven.google.com' }
。
- 在 allprojects/repositories 中将
maven { url 'https://maven.google.com' }
添加为 第一个条目 build.gradle
- 将所有播放服务和 firebase 依赖项更改为最新版本
- 已将 google-services 插件的版本更改为
classpath 'com.google.gms:google-services:4.0.1'
对于我的情况,我从 app gradle 存储库中删除了 mavenCentral()
,并将 maven { url 'https://maven.google.com' }
移动到 中的第一个位置项目 gradle 正如 Ivan Rigamonti 上面建议的那样。无需更新 Firebase 依赖项。
(这应该是评论,但我没有足够的声誉)
解决方法是将 google url 放在 gradle 的存储库列表中的 jcenter() 上方。
如果你们遇到类似 build.gradle 的错误,无法解决:常见 像这样 build.gradle error , Failed to resolve: common
然后在 allprojects scope in repositories scope in Project build.gradle
的下面一行
行:
maven { url 'https://maven.google.com' }
jcenter()
google()
例子
allprojects {
repositories {
maven { url 'https://maven.google.com' }
jcenter()
google()
}
就我而言:
allprojects {
repositories {
google()
jcenter()
}
}
解决了我的问题
- 在我的旧配置中只有 "jcenter()"
- 第一行jcenter(),第二行google()不起作用
改变
compile 'com.google.android.gms:play-services-safetynet:15.0.1'
compile 'com.google.android.gms:play-services-maps:15.0.1'
compile 'com.google.android.gms:play-services-places:15.0.1'
compile 'com.google.android.gms:play-services-location:15.0.1'
到
compile 'com.google.android.gms:play-services-safetynet:16.0.0'
compile 'com.google.android.gms:play-services-maps:16.0.0'
compile 'com.google.android.gms:play-services-places:16.0.0'
compile 'com.google.android.gms:play-services-location:16.0.0'
是我的情况,有效!
今天突然,我在 Android studio 中尝试 运行 我的应用程序时出现错误。
是:
Error: Could not find play-services-tasks.aar (com.google.android.gms:play-services-tasks:15.0.1).
Searched in the following locations:
https://jcenter.bintray.com/com/google/android/gms/play-services-tasks/15.0.1/play-services-tasks-15.0.1.aar
我没有在gradle 文件中更改任何内容,但它突然出现了。我之前的构建在几分钟前成功执行。
为什么它找不到 play-services-tasks.aar
是 com.google.android.gms 的一部分:play-services-tasks:15.0.1
采取的步数:
我检查了我是否在 gradle 文件中包含了所有存储库,到目前为止都是正确的。
为什么突然出现这个错误?
我也将此 link https://jcenter.bintray.com/com/google/android/gms/play-services-tasks/15.0.1/play-services-tasks-15.0.1.aar 复制到浏览器中,但它工作正常,也就是说,我得到了 "File Download" 对话框。
我的 Gradle 文件
应用级别
apply plugin: 'com.android.application' android { compileSdkVersion 26 buildToolsVersion "26.0.2" defaultConfig { applicationId "mekanic24assistantapplication.heba.mekanic24.com.mekanic24assistantapplication" minSdkVersion 14 targetSdkVersion 26 versionCode 13 versionName "2.1" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" multiDexEnabled true } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } dexOptions { incremental true javaMaxHeapSize "4g" } // err Android Gradle Duplicate files copied in APK META-INF/license.txt configurations.all { resolutionStrategy { force 'com.android.support:support-v4:26+' force 'com.android.support:support-annotations:26+' } } packagingOptions { exclude 'META-INF/DEPENDENCIES.txt' exclude 'META-INF/LICENSE.txt' exclude 'META-INF/NOTICE.txt' exclude 'META-INF/NOTICE' exclude 'META-INF/LICENSE' exclude 'META-INF/DEPENDENCIES' exclude 'META-INF/notice.txt' exclude 'META-INF/license.txt' exclude 'META-INF/dependencies.txt' exclude 'META-INF/LGPL2.1' } } dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' }) // compile 'com.android.support:appcompat-v7:26.3.1' compile 'com.android.support:appcompat-v7:26+' compile 'com.android.support:design:26+' compile 'com.android.support:recyclerview-v7:26+' compile 'com.android.support:cardview-v7:26+' compile 'com.android.support.constraint:constraint-layout:1.0.2' androidTestCompile 'com.android.support:support-annotations:26+' testCompile 'junit:junit:4.12' // compile 'com.android.support:appcompat-v7:26.3.1' compile 'com.github.markushi:circlebutton:1.1' // compile 'com.android.support:design:26.3.1' compile 'com.android.volley:volley:1.0.0' compile 'com.google.android.gms:play-services-base:15.0.1' compile 'com.android.support:multidex:1.0.1' compile 'com.firebase:firebase-client-android:2.5.2' compile 'com.google.firebase:firebase-core:15.0.2' compile 'com.google.firebase:firebase-messaging:15.0.2' compile 'com.google.firebase:firebase-database:15.0.0' compile 'com.wang.avi:library:2.1.3' compile 'de.hdodenhof:circleimageview:2.2.0' compile 'android.lib.recaptcha:reCAPTCHA:2.0.0' compile 'com.google.android.gms:play-services-safetynet:15.0.1' compile 'com.google.android.gms:play-services-maps:15.0.1' compile 'com.google.android.gms:play-services-places:15.0.1' compile 'com.google.android.gms:play-services-location:15.0.1' compile 'com.squareup.picasso:picasso:2.5.2' testCompile 'junit:junit:4.12' compile 'com.anjlab.android.iab.v3:library:1.0.38' compile files('libs/mail.jar') compile files('libs/additionnal.jar') compile files('libs/activation.jar') compile 'com.jakewharton:butterknife:8.8.1' annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1' compile 'com.yarolegovich:lovely-dialog:1.1.0' compile 'com.mobsandgeeks:android-saripaar:2.0.3' compile 'com.github.stfalcon:smsverifycatcher:0.3.1' compile 'ch.acra:acra:4.9.0' //TODO: Apache 2.0 license https://github.com/ACRA/acra compile 'com.google.android.gms:play-services-ads:15.0.1' compile 'com.github.luongvo:GmailBackground:2.0.2' } apply plugin: 'com.google.gms.google-services'
项目级别
buildscript { repositories { jcenter() maven { url 'https://maven.google.com' } maven { url "https://dl.bintray.com/android/android-tools" } maven { url "https://jitpack.io" } google() } dependencies { classpath 'com.android.tools.build:gradle:2.3.2' classpath 'com.google.gms:google-services:3.2.0' } } allprojects { repositories { jcenter() maven { url 'https://maven.google.com' } maven { url "https://dl.bintray.com/android/android-tools" } maven { url "https://jitpack.io" } google() } } task clean(type: Delete) { delete rootProject.buildDir }
我今天遇到了同样的问题。到现在为止一切正常。可能是暂时的 Google 服务器问题。
对我有用的解决方案是使用旧版本的 google-play-services:
implementation 'com.google.android.gms:play-services-maps:11.4.2'
难道是google改变了服务端包的命名约定?
我刚才在使用不同的播放服务包时遇到了同样的问题。
即play-services-basement.aar...
我认为
Could not find play-services-tasks.aar
表示它正在寻找名为 play-services-tasks.aar
的文件在服务器上这个文件被调用:
play-services-tasks-15.0.1.aar
我认为这是文件未正确命名的 gradle 问题或文件未正确命名的服务器端问题。
如有错误请指正
编辑:这个问题应该报告给 jcenter.bintray.com 因为他们是他们服务器端的错误。切换到 Ivan Rigamonti 提到的 Maven 存储库可能是一个解决方案,但我不确定离子应用程序如何处理切换存储库。
EDIT2:切换到 maven 存储库确实适用于 ionic。对于 ionic,我所要做的就是通过将 jcenter() 放在 buildscript 存储库和 allprojects 存储库中的 maven() 下面来改变 build.gradle。
进行以下更改后,错误消失了:
- 已从应用 build.gradle 的存储库中删除
maven { url 'https://maven.google.com' }
。 - 在 allprojects/repositories 中将
maven { url 'https://maven.google.com' }
添加为 第一个条目 build.gradle - 将所有播放服务和 firebase 依赖项更改为最新版本
- 已将 google-services 插件的版本更改为
classpath 'com.google.gms:google-services:4.0.1'
对于我的情况,我从 app gradle 存储库中删除了 mavenCentral()
,并将 maven { url 'https://maven.google.com' }
移动到 中的第一个位置项目 gradle 正如 Ivan Rigamonti 上面建议的那样。无需更新 Firebase 依赖项。
(这应该是评论,但我没有足够的声誉)
解决方法是将 google url 放在 gradle 的存储库列表中的 jcenter() 上方。
如果你们遇到类似 build.gradle 的错误,无法解决:常见 像这样 build.gradle error , Failed to resolve: common
然后在 allprojects scope in repositories scope in Project build.gradle
的下面一行行:
maven { url 'https://maven.google.com' }
jcenter()
google()
例子
allprojects {
repositories {
maven { url 'https://maven.google.com' }
jcenter()
google()
}
就我而言:
allprojects {
repositories {
google()
jcenter()
}
}
解决了我的问题
- 在我的旧配置中只有 "jcenter()"
- 第一行jcenter(),第二行google()不起作用
改变
compile 'com.google.android.gms:play-services-safetynet:15.0.1'
compile 'com.google.android.gms:play-services-maps:15.0.1'
compile 'com.google.android.gms:play-services-places:15.0.1'
compile 'com.google.android.gms:play-services-location:15.0.1'
到
compile 'com.google.android.gms:play-services-safetynet:16.0.0'
compile 'com.google.android.gms:play-services-maps:16.0.0'
compile 'com.google.android.gms:play-services-places:16.0.0'
compile 'com.google.android.gms:play-services-location:16.0.0'
是我的情况,有效!