方法.android()的签名不适用于参数类型

jgwigjjp  于 2023-10-14  发布在  Android
关注(0)|答案(4)|浏览(137)

FAILURE:生成失败,出现异常。

  • 其中:构建文件'D:\Android_Projects\firebase_app\android\app\build.gradle'行:29
  • 哪里出错了:评估项目“:app”时出现问题。

无方法签名:build_5iejyyz13fbsvjeidpc5udm23.android()适用于参数类型:(build_5iejyyz13fbsvjeidpc5udm23$_run_closure2)值:[build_5iejyyz13fbsvjeidpc5udm23$_run_closure2@38474cef]

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 Exception("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: 'com.google.gms.google-services'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
    compileSdkVersion flutter.compileSdkVersion
    ndkVersion flutter.ndkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = '1.8'
    }

    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.getx.app.db.firebaseApp"
        // You can update the following values to match your application needs.
        // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
        minSdkVersion flutter.minSdkVersion
        targetSdkVersion flutter.targetSdkVersion
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        MultiDexEnable true
    }

    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 'com.google.firebase:firebase-analytics-ktx'
    implementation platform('com.google.firebase:firebase-bom:30.0.2')
    implementation 'com.android.support:multidex:1.0.3'
}
zu0ti5jz

zu0ti5jz1#

我把MinSdkVersion改成了21,把MixeSdkVersion改成了31,这对我很有效。尝试这些,如果错误仍然存在,请通知。

8ftvxx2r

8ftvxx2r2#

试试设置:

minSdkVersion 23
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
mwecs4sa

mwecs4sa3#

**No signature of method: build_5fhogbatv7ydk09vp9xh7fztg.android() is applicable for**

First we need to remove all gradle code and copy other runinig project gradle and past here and change package name and all stuff accroding to you. 

Clean and Rebuild project and Run.

Build successfully. and working fine.
ccgok5k5

ccgok5k54#

当你的gradle文件有一个错误时,这个错误总是会出现,比如错别字或冒号或任何不适当的错误。你的错误说第29行,这就是android标签开始的地方,请检查android标签中输入的任何错误。尝试将其与另一个工作项目gradle文件进行比较。

相关问题