【发布时间】:2017-11-28 10:32:07
【问题描述】:
我知道这里已经被问过很多次了,但无论我搜索多少答案,自从我将 android studio 更新到新的稳定版本以来,它一直在发生。
我已更新每个 SDK 工具并确认已安装 Google Play 服务。我什至已经使用类路径 3.0.0 和 3.1.0 以及许多 firebase 编译版本进行了测试,但仍然会发生,我不知道还能做什么。
更新:
我在将 gradle 更新到 v3 然后将其反转到 2.3.3 后出现此错误,因为存在一些兼容性问题
我注意到有些人报告说同样的错误告诉他们它已尝试在某些存储库中查找插件,但我的只是没有
这是我的构建配置:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.google.gms:google-services:3.1.0'
}
}
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
maven { url 'http://dl.bintray.com/amulyakhare/maven' }
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
还有项目一:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.appsr.appname"
minSdkVersion 18
targetSdkVersion 25
versionCode 122
versionName "2.2.2"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
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:25.4.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:25.4.0'
compile 'com.android.support:support-vector-drawable:25.4.0'
compile 'com.android.support:recyclerview-v7:25.4.0'
compile 'com.android.support:cardview-v7:25.4.0'
//Preferences
compile 'com.android.support:preference-v7:25.4.0'
compile 'com.takisoft.fix:preference-v7:25.4.0.0' //Bugfix preference library
//HttpClient
compile 'com.squareup.okhttp3:okhttp:3.8.1'
compile 'com.github.franmontiel:PersistentCookieJar:v1.0.1'
compile 'org.jsoup:jsoup:1.9.2'
//Serialize classes in JSON
compile 'com.google.code.gson:gson:2.8.0'
//Others
compile 'com.google.android.gms:play-services-drive:11.6.2'
compile 'com.google.firebase:firebase-core:11.6.2'
compile 'com.google.firebase:firebase-crash:11.6.2'
compile 'com.google.firebase:firebase-messaging:11.6.2'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
【问题讨论】:
-
@SagarJethva 我已经完成了这篇文章中所说的一切,但仍然会发生。奇怪的是,我的错误并没有像它试图在任何存储库中搜索那样显示
-
应该尝试在您的项目级别 build.gradle
buildscript { repositories { jcenter(); mavenCentral() } -
@SagarJethva 是的,结果相同
标签: java android gradle google-play-services