I was building the APK after checking that the flutter android app was normally run in the emulator.
I add Keystore and change: signingConfig.release in app:build.gradle
But it has an error: No signature of the method.
What is this problem?
This is app:build.gradle code
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new FileNotFoundException("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 plugin: 'kotlinx-serialization'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 31
ndkVersion '23.0.7599858'
aaptOptions {
noCompress 'tflite'
noCompress 'lite'
}
sourceSets{
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
applicationId "com.healme.wisehealthylife"
minSdkVersion 21
targetSdkVersion 31
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
}
signingConfig {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig signingConfigs.release
minifyEnabled true
useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
flutter {
source '../..'
}
dependencies {
implementation 'com.google.firebase:firebase-firestore'
implementation 'com.facebook.android:facebook-android-sdk:[5,6)'
implementation 'com.google.firebase:firebase-analytics'
implementation platform('com.google.firebase:firebase-bom:28.4.1')
implementation 'androidx.multidex:multidex:2.0.1'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
This is project:build.gradle code
buildscript {
ext.kotlin_version = '1.5.31'
ext {
compileSdkVersion = 30
targetSdkVersion = 30
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.2'
classpath 'com.google.gms:google-services:4.3.10'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
This is the error message:
Terminal: C:\Users\SW2148\flutter_project\Wise Healthy Life\testlogin>flutter build apk --split-per-abi
Building with sound null safety
FAILURE: Build failed with an exception.
Where: Build file 'C:\Users\SW2148\flutter_project\Wise Healthy Life\testlogin\android\app\build.gradle' line: 35
What went wrong: A problem occurred evaluating project ':app'.
No signature of method: build_htngxzdn1u0d7ezwn29dznwg.android() is applicable for argument types: (build_htngxzdn1u0d7ezwn29d znwg$_run_closure2) values: [build_htngxzdn1u0d7ezwn29dznwg$_run_closure2@3797f448]
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan t o get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 13s Running Gradle task 'assembleRelease'... 16.0s Gradle task assembleRelease failed with exit code 1
What should I do?