【问题标题】:Error running Gradle, gradlew.bat exited abnormally, A problem occurred evaluating project运行 Gradle 时出错,gradlew.bat 异常退出,评估项目时出现问题
【发布时间】:2020-01-18 21:20:05
【问题描述】:

我曾多次尝试使用 Firebase 身份验证创建登录和注册页面,但一直收到此类错误。最初我能够成功构建(表单)布局,但 id 和 pass 未在 firebase 中注册,我收到此类错误。几天以来我一直被困在这里,请帮助。谢谢

android/app/build.gradle

def localProperties = new Properties()
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 from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 28

lintOptions {
    disable 'InvalidPackage'
}

defaultConfig {
    // TODO: Specify your own unique Application ID 
(https://developer.android.com/studio/build/application-id.html).
    applicationId "com.example.login"
    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 'com.google.firebase:firebase-analytics:17.2.0'
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'
}

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

错误- 以调试模式在 vivo 1803 上启动 lib\main.dart... * 运行 Gradle 时出错: ProcessException:进程“C:\Users\Happy\code\login\android\gradlew.bat”异常退出:

FAILURE:构建失败并出现异常。

  • 在哪里: 构建文件 'C:\Users\Happy\code\login\android\app\build.gradle' 行:24

  • 出了什么问题: 评估项目 ':app' 时出现问题。

    ASCII

  • 尝试: 使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获得更多日志输出。运行 --scan 以获得完整的见解。

  • 通过https://help.gradle.org获得更多帮助

在 2m 34s 内构建失败 命令:C:\Users\Happy\code\login\android\gradlew.bat app:properties

请查看 android/ 文件夹中的 Gradle 项目设置。 退出(sigterm)

【问题讨论】:

    标签: firebase flutter firebase-authentication


    【解决方案1】:

    您可以尝试的只是转到您的项目级别构建并更改您的类路径依赖项,如下所示。

        classpath 'com.android.tools.build:gradle:3.3.0'
        classpath 'com.google.gms:google-services:4.3.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.21"
    

    这可能对你有用。

    【讨论】:

      【解决方案2】:

      在 android/build.gradle 中将 Google 服务降低到 4.2.0 应该可以完成这项工作,不多也不少。

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

      【讨论】:

        猜你喜欢
        • 2019-10-28
        • 2020-03-19
        • 2019-12-05
        • 2021-10-07
        • 2022-07-16
        • 2022-01-07
        • 2020-08-11
        • 2021-05-25
        • 2022-08-13
        相关资源
        最近更新 更多