[英]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.