任务':app:generateDebugBuildConfig'的执行失败。 > java.io.FileNotFoundException:

时间:2020-07-23 15:49:27

标签: flutter google-cloud-firestore build.gradle hybrid-mobile-app mobile-application

我刚刚尝试通过我的flutter应用程序设置Firestore。当我尝试运行和调试我的app 2错误时,显示了以下信息:

  1. 任务':app:generateDebugBuildConfig'的执行失败。

java.io.FileNotFoundException:F:\ Harsh \ flutter_projects \ Coach Ui \ code_ui \ build \ app \ generated \ source \ buildConfig \ debug \ com \ example \ code_ui \ BuildConfig.java(系统找不到指定的路径)

2)Gradle从网络下载工件时抛出错误。正在尝试下载...

在应用程序下构建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.code_ui"
    minSdkVersion 21
    targetSdkVersion 28
    versionCode flutterVersionCode.toInteger()
    versionName flutterVersionName
}

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"
 }
 apply plugin: 'com.google.gms.google-services'

在Android下构建gradle

     dependencies {
    classpath 'com.android.tools.build:gradle:3.5.0'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    classpath 'com.google.gms:google-services:4.3.3'
   }
   }

pubspec下的依赖项

 dependencies:
 flutter:
 sdk: flutter


 # The following adds the Cupertino Icons font to your application.
 # Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.3
firebase_auth: ^0.16.1 
cloud_firestore: ^0.13.7

1 个答案:

答案 0 :(得分:0)

我通过以下方式解决了该问题:

  1. 在Android文件夹下构建gradle:

    更改:classpath 'com.google.gms:google-services:4.3.3'

    收件人:classpath 'com.google.gms:google-services:4.3.2'

  2. 从Flutter项目的根目录在终端上运行此程序:

    干净整洁

  3. 另外,从您的仿真器/设备上卸载应用程序,然后最终构建它。