Flutter Firebase插件问题:不兼容问题
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Flutter Firebase插件问题:不兼容问题相关的知识,希望对你有一定的参考价值。
我在flutter项目中添加了Firebase插件后,出现以下错误:ProcessException:进程“ C: projects ecommerce android gradlew.bat”异常退出:启动Gradle守护进程(后续构建会更快)
FAILURE:构建失败,出现异常。*其中:构建文件“ C: projects ecommerce android app build.gradle”行:24* 什么地方出了错:评估项目':app'时发生问题。
无法应用插件[id'com.android.application']支持的最低Gradle版本是5.4.1。当前版本是4.10.2。如果使用gradle包装器,请尝试编辑C: projects ecommerce android gradle wrapper gradle-wrapper.properties中的distributionUrl到gradle-5.4.1-all.zip。
这是我的android app build.gradle。
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 28
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.ecommerce"
minSdkVersion 16
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.firebase:firebase-analytics:17.2.0'
}
apply plugin: 'com.google.gms.google-services'
这是我的android build.gradle:
buildscript {
ext.kotlin_version = '1.2.71'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.2'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
// ====SUBPROJECT DEPENDENCIES START HERE
subprojects {
project.evaluationDependsOn(':app')
project.configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'androidx.core'
&& !details.requested.name.contains('androidx') ) {
details.useVersion "1.0.1"
}
}
}
}
//ENDS HERE
task clean(type: Delete) {
delete rootProject.buildDir
}
gradle在C: Program Files Android Android Studio gradle中的版本:是5.1.1。我的android build.gradle中的gradle版本,依赖项:
dependencies {
classpath 'com.android.tools.build:gradle:3.5.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.2'
}```
I dont know if there's any conflict between
```classpath 'com.google.gms:google-services:4.3.2' ```
with:
```classpath 'com.android.tools.build:gradle:3.5.2'```
Please help
以上是关于Flutter Firebase插件问题:不兼容问题的主要内容,如果未能解决你的问题,请参考以下文章
Flutter 设备预览和 Firebase 身份验证不兼容
Flutter:CocoaPods 找不到 pod“Firebase/Messaging”的兼容版本