【发布时间】:2021-10-07 03:43:48
【问题描述】:
我尝试运行我的第一个 firebase 应用程序,但由于此错误而无法运行:
FAILURE:构建失败并出现异常。
- 在哪里: 构建文件 'C:\Users\boras\OneDrive\Masaustu\Software\ProgramlamaTemelliYazilim\Flutter\firebase_application\firebase_application\android\app\build.gradle' 行:29
- 出了什么问题: 评估项目“:app”时出现问题。
没有方法签名:build_884xt67ny8crpgv70jgbem96p.android() 适用于参数类型:(build_884xt67ny8crpgv70jgbem96p$_run_closure2) 值:[build_884xt67ny8crpgv70jgbem96p$ure2) 值:[build_884xt67ny8crpgv70jgbem966
- 尝试: 使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获得更多日志输出。运行 --scan 以获得完整的见解。
- 在https://help.gradle.org 获得更多帮助
这就是我 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 plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 30
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.firebase_application"
minSdkVersion 23
targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
classpath 'com.android.tools.build:gradle:4.2.0'
}
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"
implementation platform('com.google.firebase:firebase-bom:26.3.0')
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-messaging'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
compile 'com.android.support:multidex:2.0.1'
implementation platform('com.google.firebase:firebase-bom:28.3.0')
classpath 'com.google.gms:google-services:4.2.0'
}
【问题讨论】:
标签: firebase flutter gradle android-gradle-plugin build.gradle