gpt4 book ai didi

android - 无法解析 ':app@debug/compileClasspath' : Could not resolve com. google.android.gms :play-services-basement:[15. 0.0,16.0.0 的依赖关系)

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:59:22 24 4
gpt4 key购买 nike

我收到这个错误:这是我的 build.gradle(Module:app)

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

android {
compileSdkVersion 26
defaultConfig {
applicationId "com.mycompany.myapp"
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dataBinding.enabled = true
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.google.firebase:firebase-core:15.0.0'
compileOnly "org.projectlombok:lombok:1.16.20"
annotationProcessor 'org.projectlombok:lombok:1.16.20'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.google.code.gson:gson:2.8.1'
implementation 'com.android.volley:volley:1.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.google.android.gms:play-services-maps:15.0.0'
implementation 'com.google.android.gms:play-services-location:15.0.0'
implementation 'com.google.android.gms:play-services-places:15.0.0'
implementation 'com.paytm.pgsdk:pgsdk:1.0.8'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
compile 'com.crashlytics.sdk.android:crashlytics:2.9.1'
}

apply plugin: 'com.google.gms.google-services'

这是我的build.gradle(Project: myApp)

buildscript {

repositories {
google()
jcenter()
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'io.fabric.tools:gradle:1.25.1'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:3.1.0'
}
}

allprojects {
repositories {
google()
jcenter()
maven {
url 'https://maven.google.com/'
}
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

我查看了其他解决方案,大多数建议添加

maven { url "https://maven.google.com"}

到项目的build.gradle。我已经试过了,但我仍然遇到同样的错误。

我在 android studio 3.0 上。我也尝试添加 google() 而不是 maven(另一个建议)

最佳答案

选项 1:

按照以下说明解决。

Project-level build.gradle

使用

maven { url "https://www.jitpack.io" }

代替

maven { url "https://jitpack.io" }

选项 2:

Project-level build.gradle

google() 存储库应该是第一优先级

allprojects {
repositories {
google()
mavenLocal()
jcenter()
}
}

选项 3:

按照以下步骤解决。

第一步:

Project-level build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.google.gms:google-services:4.2.0' // google-services plugin
classpath 'com.android.tools.build:gradle:3.4.2'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
maven { url "http://dl.bintray.com/populov/maven" }
maven { url "https://jitpack.io" } // For Ucrop
maven { url "https://maven.google.com" } // Google's Maven repository - FCM
maven {
url 'https://dl.bintray.com/azeesoft/maven'
}
google()
jcenter()
mavenCentral()
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

第二步:

App-level build.gradle

我已经更新了 One Signal 版本。

使用

implementation 'com.onesignal:OneSignal:3.11.1'

代替

implementation 'com.onesignal:OneSignal:3.10.9' 

关于android - 无法解析 ':app@debug/compileClasspath' : Could not resolve com. google.android.gms :play-services-basement:[15. 0.0,16.0.0 的依赖关系),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50822138/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com