Java 如何修复错误:id为';gms:googleservices:4.2.0';找不到
我四处寻找以解决此错误,但仍然没有找到任何解决方案 我曾尝试切换到其他谷歌服务版本,但根本不包括任何版本,但都不起作用。在网上找不到解决方案也无法解决此问题 我的build.gradle(项目)代码是: 我的build.gradle(模块:app)代码是:Java 如何修复错误:id为';gms:googleservices:4.2.0';找不到,java,android,android-gradle-plugin,Java,Android,Android Gradle Plugin,我四处寻找以解决此错误,但仍然没有找到任何解决方案 我曾尝试切换到其他谷歌服务版本,但根本不包括任何版本,但都不起作用。在网上找不到解决方案也无法解决此问题 我的build.gradle(项目)代码是: 我的build.gradle(模块:app)代码是: 以下是可以帮助您的步骤: 1。首先,将您的“com.android.tools.build:gradle”版本从“3.4.0”降级为“3.3.2” 2。打开“gradle wrapper.properties”并用“5.1.1-all”版本更
以下是可以帮助您的步骤: 1。首先,将您的“com.android.tools.build:gradle”版本从“3.4.0”降级为“3.3.2” 2。打开“gradle wrapper.properties”并用“5.1.1-all”版本更新您的distributionUrl,如下所示
#Mon May 06 12:26:03 IST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
3。打开“gradle.properties”并在下面两行添加
android.useAndroidX=true
android.enableJetifier=true
4。然后按如下方式更新您的应用程序级别梯度:
问题是你使用了这个符号“:”而不是“.”来申请“谷歌服务”
错误的插件实现=>apply插件:“com.google.gms:google服务”
右插件实现=>应用插件:“com.google.gms.google服务”
期末成绩:
在你的应用程序级别gradle中只添加这样的内容,我的意思是删除版本=>apply插件:“com.google.gms.google services”@android谢谢你的回复。如果我删除了版本号,它会在下面一行显示一个关于混合版本=>implementation'com.android.support:appcompat-v7:28.0.0'的错误,谢谢您的回答。但是这在主java代码中给了我很多错误,可能是因为版本不匹配!它们可以是导入语句。正确的?例如,您必须导入“androidx.appcompat.app.AppCompatActivity”而不是“android.support.v7.app.AppCompatActivity”,因为我们使用的是androix库而不是support appcomart库
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.google.gms:google-services:4.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
#Mon May 06 12:26:03 IST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
android.useAndroidX=true
android.enableJetifier=true
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.ankit.gradletest511"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.0-beta01'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.firebase:firebase-core:16.0.8'
implementation 'com.google.firebase:firebase-auth:16.2.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
}
apply plugin: 'com.google.gms.google-services'