扑火基础错误“失败:生成失败,出现异常”

时间:2019-11-30 02:10:26

标签: flutter firebase-realtime-database dart build.gradle flutter-dependencies

project / build.gradle

应用插件:“ com.android.application”

dependencies {
    classpath 'com.android.tools.build:gradle:3.2.1'
    classpath 'com.google.gms:google-services:4.3.2'
}

在app / build.gradle中

第24行应用插件:“ 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 "blablabla.com"
        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 {
    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'

在pubspec.yaml中

dependencies:
  flutter:
    sdk: flutter
  firebase_database: ^2.0.2
  firebase_core: ^0.3.1+1
  timeago: ^2.0.10

出现此错误

$ flutter run
Using hardware rendering with device Android SDK built for x86. If you
get graphics artifacts, consider enabling software rendering with       
"--enable-software-rendering".
Launching lib\main.dart on Android SDK built for x86 in debug mode...
Initializing gradle...                                             2.2s 
Resolving dependencies...                                               
* Error running Gradle:
ProcessException: Process
"C:\Users\Krishnaganesh\Desktop\flutter_blog_app-master\android\gradlew.bat" exited abnormally:

FAILURE: Build failed with an exception.

* Where:
Build file
'C:\Users\Krishnaganesh\Desktop\flutter_blog_app-master\android\app\build.gradle' line: 24

* What went wrong:
A problem occurred evaluating project ':app'.
> ASCII

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or
--debug option to get more log output. Run with --scan to get full
insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 3s
  Command:
  C:\Users\Krishnaganesh\Desktop\flutter_blog_app-master\android\gradlew  .bat app:properties


Please review your Gradle project setup in the android/ folder.

如何解决此错误... ???

1 个答案:

答案 0 :(得分:0)

凹凸依赖版本:

Table2 = df.loc[df.Date.between('2018-11-22','2018-11-30') & (df['Region'] == 'Canada')].groupby(df['FPYear'])[['New Customer', 'Existing Customer', 'revenue']].sum() #with date filters for table
classpath 'com.android.tools.build:gradle:3.5.2'
classpath 'com.google.gms:google-services:4.3.3'

app / build.gradle 中添加以下内容:

  firebase_database: ^3.1.0
  firebase_core: ^0.4.2+1

别忘了在app /文件夹中创建android { ... defaultConfig { ... multiDexEnabled true // add this } } dependencies { ... implementation 'com.android.support:multidex:1.0.3' // add this } 文件,并用您的数据(docs link)填充文件或使用一些模拟文件(例如this one):

google-services.json