bud*_*hiv 14 android gradle firebase react-native react-native-firebase
有没有人按照官方文档遇到过这个问题react-native-firebase?
ERROR: Could not find method platform() for arguments [com.google.firebase:firebase-bom:21.1.0] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
Open File
Run Code Online (Sandbox Code Playgroud)
这是在编辑这两个build.gradle文件并单击syncAndroid Studio 弹出窗口后发生的。我认为这是因为 gradle 问题。
欢迎任何帮助。虽然找不到类似的问题。
build.gradle根据 Gabriele Mariotti 的要求编辑了两个文件的问题。
这是build.gradle文件内容。
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 23
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"
}
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.google.gms:google-services:4.2.0'
classpath 'com.android.tools.build:gradle:3.3.1'
}
}
allprojects {
repositories {
mavenLocal()
google()
jcenter()
maven {
url "$rootDir/../node_modules/react-native/android"
}
}
}
Run Code Online (Sandbox Code Playgroud)
这是app/build.gradle文件内容。
apply plugin: "com.android.application"
apply from: "../../node_modules/react-native/react.gradle"
android {
compileSdkVersion rootProject.ext.compileSdkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
applicationId "my.app.id"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 33
versionName "2.2.2"
multiDexEnabled true
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.multidex:multidex:2.0.1'
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation "com.facebook.react:react-native:+" // From node_modules
implementation 'com.google.firebase:firebase-core:17.0.0'
}
apply plugin: 'com.google.gms.google-services'
Run Code Online (Sandbox Code Playgroud)
这两个build.gradle文件都根据文档进行了修改。
小智 12
所以,我认为您正在使用 Gradle 4.x。我遇到过同样的问题。升级到 5.0 解决了:https : //docs.gradle.org/current/userguide/upgrading_version_4.html
解决方案:放入android/gradle/wrapper/gradle-wrapper.properties:
distributionUrl=https://services.gradle.org/distributions/gradle-5.4.1-all.zip
Run Code Online (Sandbox Code Playgroud)
按照此链接:https : //github.com/FirebaseExtended/flutterfire/issues/3287
| 归档时间: |
|
| 查看次数: |
11196 次 |
| 最近记录: |