Home > OS >  Why is show "No signature of method" when apps run?
Why is show "No signature of method" when apps run?

Time:09-22

FAILURE: Build failed with an exception.

  • Where: Build file 'F:\Flutter_Workspace_omor\flutter_bajeapp_map\android\app\build.gradle' line: 27

  • What went wrong: A problem occurred evaluating project ':app'.

No signature of method: build_7tsh17nr3y3u45y06ssyoeilw.android() is applicable for argument types: (build_7tsh17nr3y3u45y06ssyoeilw$_run_closure2) values: [build_7tsh17nr3y3u45y06ssyoeilw$_run_closure2@1cb8ab65]

  • 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.

my build.gradle file source code:

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 30

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.example.flutter_bajeapp_map"
        Version 20
        targetSdkVersion 30
        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
        }
    }
}
dependencies {
    // add dependancies for location insert purpose
    implementation 'com.google.android.gms:play-services-vision:20.1.3'
    implementation 'com.google.android.gms:play-services-location:17.1.0'
    implementation 'com.google.maps.android:android-maps-utils:0.5'
    implementation 'com.google.code.gson:gson:2.8.6'
}
flutter {
    source '../..'
}

CodePudding user response:

From the defaultConfig, remove the Version 20 and also add the minSdkVersion 16 to it.

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.example.flutter_bajeapp_map"
        minSdkVersion 16
        targetSdkVersion 30
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }
  • Related