关于android:安装Firebase时支持的最低Gradle版本错误

Minimum supported Gradle version error when installing Firebase

我正在尝试为我的应用发送推送通知。我从一个空白的应用程序(react-native init)开始,然后安装了firebase,将其链接起来,然后按照说明进行操作。首先,在这里https://rnfirebase.io/docs/v5.x.x/installation/initial-setup
然后在这里https://rnfirebase.io/docs/v5.x.x/installation/android
我在build.gradle中添加了所有必需的行,并将gradle url更改为gradle-4.4-all.zip
但是当我尝试运行该应用程序时,出现错误

1
Failed to apply plugin [id 'com.android.application']

Minimum supported Gradle version is 4.10.1. Current version is 4.4. If using the gradle wrapper, try editing the distributionUrl in /Users/irondsd/dev/RNFirebase/android/gradle/wrapper/gradle-wrapper.properties to gradle-4.10.1-all.zip

我尝试过两次,以确保我没有错过任何比赛。但是我每次都会遇到同样的错误。我试图用Google搜索,但找不到很多。

这是我添加到项目级别build.gradle

的内容

1
2
    classpath 'com.google.gms:google-services:4.2.0'
    classpath 'com.android.tools.build:gradle:3.3.2'

在app / build.gradle中:

1
2
3
4
5
6
implementation project(':react-native-firebase')
implementation"com.google.android.gms:play-services-base:16.1.0"
implementation"com.google.firebase:firebase-core:16.0.8"

// at the end of the file
apply plugin: 'com.google.gms.google-services'

这是react本机版本和react-native-firebase版本

1
2
3
"react":"16.8.3",
"react-native":"0.59.4",
"react-native-firebase":"^5.3.0"

我在做错什么吗?


转到android/gradle/wrapper/gradle-wrapper.properties并将distributionUrl更改为
distributionUrl=https\\://services.gradle.org/distributions/gradle-4.10-all.zip

它将解决问题。