简体   繁体   English

使用 com.google.gms 时出错:google-services: 4.3.4

[英]Error using com.google.gms: google-services: 4.3.4

I am trying to connect Firebase project to my app.我正在尝试将 Firebase 项目连接到我的应用。 But when I add "classpath" com.google.gms: google-services: 4.3.4" AS is giving this error:但是当我添加 "classpath" com.google.gms: google-services: 4.3.4" AS 时,会出现以下错误:

Cause: unable to find valid certification path to requested target原因:无法找到到请求目标的有效认证路径

What should I do?我该怎么办?

build.gradle:构建.gradle:

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

 buildscript {
repositories {
    google()
    jcenter()
}
dependencies {
    classpath "com.android.tools.build:gradle:4.0.1"
    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()
        jcenter()
}
}

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

build.gradle(app): build.gradle(应用程序):

 android {
compileSdkVersion 30
buildToolsVersion "29.0.3"

defaultConfig {
    applicationId "com.vogella.findpeople"
    minSdkVersion 14
    targetSdkVersion 30
    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.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
implementation 'androidx.annotation:annotation:1.1.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'


implementation 'com.google.firebase:firebase-auth:19.4.0'
implementation 'com.google.firebase:firebase-database:19.5.0'
}

The link I flagged should work for you.我标记的链接应该对你有用。 Try this尝试这个

classpath 'com.google.gms:google-services:4.3.3'

Replace your classpath with this and resync.用这个替换你的类路径并重新同步。

尝试将您的apply plugin:行移动到 app build.gradle 文件而不是项目一

I had a similar problem with regard to adding this classpath 'com.google.gms:google-services:4.3.4' but it seems like I had a bad internet connection, and when I had a strong internet connection, this error occurred,我在添加这个classpath 'com.google.gms:google-services:4.3.4'遇到了类似的问题,但似乎我的互联网连接不好,当我有一个强大的互联网连接时,发生了这个错误, 在此处输入图片说明

it also occurred to me that that error was also due to a poor internet connection, after I fixed that then this error occurred,我也想到那个错误也是由于互联网连接不良,在我修复之后发生了这个错误, 在此处输入图片说明

this was because I included this implementation platform('com.google.firebase:firebase-bom:26.0.0') in build.gradle file within the app directory.这是因为我在app目录的build.gradle文件中包含了这个implementation platform('com.google.firebase:firebase-bom:26.0.0') So I commented it out and now I was able to run the flutter app in my android device.所以我commented it out ,现在我可以在我的 android 设备上运行 flutter 应用程序了。 Like this,像这样, 在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 com.google.gms:google-services:4.3.4 选择了不正确的 google-services.json - Incorrect google-services.json is picked by com.google.gms:google-services:4.3.4 无法为抽象类“GoogleServicesTask”创建代理类。 使用“com.google.gms:google-services:4.3.4” - Cannot create a proxy class for abstract class 'GoogleServicesTask'. with 'com.google.gms:google-services:4.3.4' 找不到com.google.gms:google-services:9.0.0 - Could not find com.google.gms:google-services:9.0.0 找不到 com.google.gms:google-services:4.2.3 - Could not find com.google.gms:google-services:4.2.3 无法解析 com.google.gms:google-services:4.3.3 - Could not resolve com.google.gms:google-services:4.3.3 无法解析 com.google.gms:google-services:3.0.0 - Could not resolve com.google.gms:google-services:3.0.0 找不到com.google.gms:google-services:3.1.1 - Could not find com.google.gms:google-services:3.1.1 收到错误消息“找不到com.google.gms:google-services:2.0.0-alpha6。” - Getting error message “Could not find com.google.gms:google-services:2.0.0-alpha6.” 错误:将Firebase导入代码示例时,找不到com.google.gms:google-services:3.0.0 - Error:Could not find com.google.gms:google-services:3.0.0 when importing Firebase to a code sample 如何修复错误:找不到 com.google.gms: google-services: 3.0.0.? - How to fix Error:Could not find com.google.gms: google-services: 3.0.0.?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM