提问人:Jyotiranjan Tripathy 提问时间:5/10/2020 最后编辑:Jyotiranjan Tripathy 更新时间:5/11/2020 访问量:1210
错误:无法解析“:app@debug/compileClasspath”的依赖项:无法解析 com.google.android.gms:play-services-base
ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.google.android.gms:play-services-base
问:
正如你所看到的,这里是我在尝试同步我的项目时遇到的错误,我一次又一次地遇到这个问题。Gradle 处于在线模式。我也尝试了离线模式,但发现了同样的问题。
我也尝试了很多方法,但仍然无法解决这个问题。
Gradle 同步错误
ERROR: Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve com.google.android.gms:play-services-base:[10.2.1, 16.1.99]
Build.gradle (项目)
顶级构建文件,您可以在其中添加所有子项目/模块通用的配置选项。
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.3'
classpath 'com.google.gms:google-services:4.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
mavenLocal()
jcenter()
maven { url "https://maven.google.com" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Build.gradle (:应用)
buildscript {
repositories {
maven { url 'https://plugins.gradle.org/m2/' }
}
dependencies {
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.6, 0.99.99]'
}
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
repositories {
maven { url 'https://maven.google.com' }
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
useLibrary 'org.apache.http.legacy'
defaultConfig {
vectorDrawables {
useSupportLibrary = true
}
vectorDrawables.useSupportLibrary = true
applicationId "com.game.pubg.best.tournaments"
// TODO: Please update the OneSignal ID below to yours!
manifestPlaceholders = [onesignal_app_id: '6554b669-a188-4110-8836-b181ff64894b',
// Project number pulled from dashboard, local value is ignored.
onesignal_google_project_number: 'REMOTE']
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
javaCompileOptions {
annotationProcessorOptions {
includeCompileClasspath false
}
}
}
repositories {
mavenCentral()
maven { url 'http://repo1.maven.org/maven2' }
maven { url "http://jcenter.bintray.com" }
maven { url "https://www.jitpack.io" }
maven { url "https://maven.google.com" }
maven { url 'https://dl.bintray.com/drummer-aidan/maven' }
maven { url "https://s3-ap-southeast-1.amazonaws.com/godel-release/godel/" }
jcenter()
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
// debug {
// minifyEnabled true
// proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
// }
}
}
apply plugin: 'com.google.gms.google-services'
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:support-vector-drawable:28.0.0'
// implementation 'ai.devsupport.instamojo:instamojolib:0.1.6'
androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.2',
{
exclude group: 'com.android.support', module: 'support-annotations'
}
)
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:design:28.0.0'
// implementation 'com.google.android.gms:play-services-ads:17.0.0'
implementation 'de.hdodenhof:circleimageview:3.1.0'
implementation 'com.facebook.shimmer:shimmer:0.5.0'
implementation 'me.zhanghai.android.materialprogressbar:library:1.6.1'
implementation 'com.github.bumptech.glide:glide:4.11.0'
implementation 'com.onesignal:OneSignal:[3.13.0, 3.99.99]'
implementation('com.paytm:pgplussdk:1.3.3')
{
transitive = true
}
implementation 'org.jsoup:jsoup:1.13.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.android.gms:play-services-auth:18.0.0'
}
答:
0赞
MMG
5/10/2020
#1
添加到 build.gradle (:app) 尝试这个问题答案的依赖关系:Android Studio 找不到 Kotlin 依赖项apply plugin: 'com.google.gms.google-services'
评论
0赞
Jyotiranjan Tripathy
5/10/2020
我收到了另外两个错误:- org.gradle.api.plugins.UnknownPluginException:找不到 id 为“com.google.gms.google-services”的插件。groovy.lang.MissingPropertyException:无法获取 org.gradle.api.Project 类型的项目“:app”的未知属性“android”。
0赞
MMG
5/10/2020
检查您的互联网连接。也许你需要VPN。@JyotiranjanTripathy
0赞
Jyotiranjan Tripathy
5/10/2020
亲爱的,你能帮忙吗?因为我搜索了 2 天,我尝试了一切。
0赞
MMG
5/10/2020
我修改了答案@JyotiranjanTripathy
0赞
Jyotiranjan Tripathy
5/10/2020
亲爱的先生,我没有使用 Koltin,我对此一无所知。我编辑了我的问题并更新了一些代码。请就下一步如何解决此错误提供一些建议。
评论