neckaros / secure_application

Secure your application from prying eyes
MIT License
103 stars 61 forks source link

No signature of method: build_…android() applicable for argument types: (build_…_run_closure2) #24

Closed ghostman2013 closed 2 years ago

ghostman2013 commented 3 years ago

Hello!

I can't build my Flutter app for Android after adding the secure_application package, it crashes with error below:

Build file '/usr/local/Caskroom/flutter/2.2.2/flutter/.pub-cache/hosted/pub.dartlang.org/secure_application-3.7.3/android/build.gradle' line: 27

A problem occurred evaluating project ':secure_application'.
> No signature of method: build_c5ahy1849z3l6msywlxga8k28.android() is applicable for argument types: (build_c5ahy1849z3l6msywlxga8k28$_run_closure2) values: [build_c5ahy1849z3l6msywlxga8k28$_run_closure2@62470d9]

Here is my build.gradle of app module:

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"

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.mobile"
        minSdkVersion 24
        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
        }
    }
    buildToolsVersion '30.0.3'
}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}

build.gradle of project:

buildscript {
    ext.kotlin_version = '1.5.21'
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:7.0.0'
        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
}

And pubspec.yaml of Flutter:

name: mobile
description: Mobile

version: 1.0.0+1

environment:
  sdk: ">=2.12.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  flutter_localizations:
    sdk: flutter
  intl: ^0.17.0
  cupertino_icons: ^1.0.3
  equatable: ^2.0.3
  flutter_bloc: ^7.0.1
  get_it: ^7.2.0
  hex: ^0.2.0
  path: ^1.8.0
  qr_flutter: ^4.0.0
  qr_code_scanner: ^0.5.2
  secp256k1: ^0.3.0
  sqflite_sqlcipher: ^2.0.0
  sha3: ^0.2.0
  share_plus: ^2.1.4
  shared_preferences: ^2.0.6
  secure_application: ^3.7.3

dev_dependencies:
  flutter_test:
    sdk: flutter
  build_runner:
  test:

flutter:
  generate: true
  uses-material-design: true
  assets:
    - assets/scripts/sqlite_v1.sql

What am I doing wrong? Where can the problem be?

bhoominn commented 2 years ago

getting the same issue, please resolve it.

neckaros commented 2 years ago

@bhoominn i published version 3.8 tell me if it solves your issue i was successfull in building it on a android VD running android 11

neckaros commented 2 years ago

without a reply from @bhoominn i will close this issue. Do not hesitate to reopen if necessary. Thanks again @ghostman2013 👍