Skip to content

No signature of method: static FlutterPlugin.useProguard() is applicable for argument types: (Boolean) values: [true] #40213

Closed

Description

@ezraaaa

Steps to Reproduce

  1. use flutter channel master
  2. flutter build appbundle -v or flutter build apk -v

Logs

.
.
.
[   +2 ms] Running Gradle task 'bundleRelease'...
[   +7 ms] executing: [/Users/ezragunn/private-develop/projects/codecumbers/android/]
/Users/ezragunn/private-develop/projects/codecumbers/android/gradlew -Pverbose=true -Ptarget=lib/main.dart
-Ptrack-widget-creation=false -Pproguard=true -Ptarget-platform=android-arm,android-arm64 bundleRelease
[+2302 ms] FAILURE: Build failed with an exception.
[   +3 ms] * Where:
[        ] Script '/Users/ezragunn/private-develop/SDKs/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 163
[        ] * What went wrong:
[        ] A problem occurred evaluating script.
[        ] > Failed to apply plugin [class 'FlutterPlugin']
[        ]    > No signature of method: static FlutterPlugin.useProguard() is applicable for argument types: (Boolean) values:
[true]
[        ] * 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.
[        ] * Get more help at https://help.gradle.org
[        ] BUILD FAILED in 2s
[ +740 ms] Running Gradle task 'bundleRelease'... (completed in 3.1s)
[   +7 ms] "flutter appbundle" took 283,198ms.
Gradle task bundleRelease failed with exit code 1

#0      throwToolExit (package:flutter_tools/src/base/common.dart:28:3)
#1      _buildGradleProjectV2 (package:flutter_tools/src/android/gradle.dart:791:5)
<asynchronous suspension>
#2      buildGradleProject (package:flutter_tools/src/android/gradle.dart:519:14)
<asynchronous suspension>
#3      _AndroidBuilderImpl.buildAab (package:flutter_tools/src/android/android_builder.dart:136:12)
<asynchronous suspension>
#4      BuildAppBundleCommand.runCommand (package:flutter_tools/src/commands/build_appbundle.dart:75:26)
<asynchronous suspension>
#5      FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:490:18)
#6      _asyncThenWrapperHelper.<anonymous closure> (dart:async-patch/async_patch.dart:71:64)
#7      _rootRunUnary (dart:async/zone.dart:1132:38)
#8      _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#9      _FutureListener.handleValue (dart:async/future_impl.dart:137:18)
#10     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:678:45)
#11     Future._propagateToListeners (dart:async/future_impl.dart:707:32)
#12     Future._completeWithValue (dart:async/future_impl.dart:522:5)
#13     Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:552:7)
#14     _rootRun (dart:async/zone.dart:1124:13)
#15     _CustomZone.run (dart:async/zone.dart:1021:19)
#16     _CustomZone.runGuarded (dart:async/zone.dart:923:7)
#17     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:963:23)
#18     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
#19     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
#20     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:116:13)
#21     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:173:5)

Ezras-MacBook-Pro:codecumbers ezragunn$ flutter doctor -v
[✓] Flutter (Channel master, v1.10.2-pre.31, on Mac OS X 10.14.6 18G95, locale en-GB)
    • Flutter version 1.10.2-pre.31 at /Users/ezragunn/private-develop/SDKs/flutter
    • Framework revision 1676b012e8 (2 hours ago), 2019-09-10 19:01:12 -0700
    • Engine revision 7ea9884ab0
    • Dart version 2.5.0 (build 2.5.0-dev.4.0 be66176534)

 
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /Users/ezragunn/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.2
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 10.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 10.3, Build version 10G8
    • CocoaPods version 1.7.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 3.5)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 39.0.3
    • Dart plugin version 191.8423
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

[✓] IntelliJ IDEA Community Edition (version 2019.2.2)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin version 39.0.5
    • Dart plugin version 192.6603.23

[✓] Connected device (2 available)
    • iPhone Xʀ • 14576690-91D8-430C-A80E-A32CC3459002 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-12-4
      (simulator)
    • Chrome    • chrome                               • web-javascript • Google Chrome 76.0.3809.132 

Activity

  1. ezraaaa commented on Sep 11, 2019

    @ezraaaa
    Author

    gradle.properties

    org.gradle.jvmargs=-Xmx1536M
    android.useAndroidX=true
    android.enableJetifier=true
    android.uniquePackageNames=true
    android.enableR8=true
    

    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"
    
    def keystoreProperties = new Properties()
    def keystorePropertiesFile = rootProject.file('key.properties')
    if (keystorePropertiesFile.exists()) {
        keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
    }
    
    android {
        compileSdkVersion 28
    
        sourceSets {
            main.java.srcDirs += 'src/main/kotlin'
        }
    
        lintOptions {
            disable 'InvalidPackage'
        }
    
        defaultConfig {
            // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
            applicationId "xyz.codeink.codecumbers"
            minSdkVersion 16
            targetSdkVersion 28
            versionCode flutterVersionCode.toInteger()
            versionName flutterVersionName
            testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
            multiDexEnabled true
        }
    
        signingConfigs {
            release {
                keyAlias keystoreProperties['keyAlias']
                keyPassword keystoreProperties['keyPassword']
                storeFile file(keystoreProperties['storeFile'])
                storePassword keystoreProperties['storePassword']
            }
        }
        buildTypes {
            release {
                signingConfig signingConfigs.release
    
                minifyEnabled false
                shrinkResources true
    
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    }
    
    flutter {
        source '../..'
    }
    
    dependencies {
        implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
        testImplementation 'junit:junit:4.12'
        androidTestImplementation 'androidx.test:runner:1.2.0'
        androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
        implementation 'com.google.firebase:firebase-core:17.2.0'
    }
    apply plugin: 'com.google.gms.google-services'
    

    proguard-rules.pro

    #Flutter Wrapper
    -keep class io.flutter.app.** { *; }
    -keep class io.flutter.plugin.**  { *; }
    -keep class io.flutter.util.**  { *; }
    -keep class io.flutter.view.**  { *; }
    -keep class io.flutter.**  { *; }
    -keep class io.flutter.plugins.**  { *; }
    
    # Add project specific ProGuard rules here.
    # By default, the flags in this file are appended to flags specified
    # in /usr/local/google/home/samstern/android-sdk-linux/tools/proguard/proguard-android.txt
    # You can edit the include path and order by changing the proguardFiles
    # directive in build.gradle.
    #
    # For more details, see
    #   http://developer.android.com/guide/developing/tools/proguard.html
    
    # Add any project specific keep options here:
    
    # If your project uses WebView with JS, uncomment the following
    # and specify the fully qualified class name to the JavaScript interface
    # class:
    #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
    #   public *;
    #}
    
    # Uncomment this to preserve the line number information for
    # debugging stack traces.
    -keepattributes SourceFile,LineNumberTable
    
    # If you keep the line number information, uncomment this to
    # hide the original source file name.
    #-renamesourcefileattribute SourceFile
    
    # Keep custom model classes
    -keep class com.google.firebase.** { *; }
    
    # https://github.com/firebase/FirebaseUI-Android/issues/1175
    -dontwarn okio.**
    -dontwarn retrofit2.Call
    -dontnote retrofit2.Platform$IOS$MainThreadExecutor
    -keep class android.support.v7.widget.RecyclerView { *; }
    
    # To ignore minifyEnabled: true error
    # https://github.com/flutter/flutter/issues/19250
    #https://github.com/flutter/flutter/issues/37441
    -ignorewarnings
    -keep class * {
        public private *;
    }
    
  2. added
    t: gradle"flutter build" and "flutter run" on Android
    toolAffects the "flutter" command-line tool. See also t: labels.
    platform-androidAndroid applications specifically
    on Sep 11, 2019
  3. p30arena commented on Sep 11, 2019

    @p30arena
    Contributor

    I'm having the same error after updating the master channel

  4. gunnardag commented on Sep 11, 2019

    @gunnardag

    I'm also having the same error on master, but stable was updated recently so temporary solution is to switch to stable.

  5. ezraaaa commented on Sep 11, 2019

    @ezraaaa
    Author

    dev works

  6. self-assigned this
    on Sep 11, 2019
  7. blasten commented on Sep 11, 2019

    @blasten

    Would you mind pasting the content of the file <app-directory>/android/gradle/wrapper/gradle-wrapper.properties and the content of the file <app-directory>/android/build.gradle?

  8. GroovinChip commented on Sep 11, 2019

    @GroovinChip
    Contributor

    No branch works for me. I am unable to build releases.

  9. blasten commented on Sep 11, 2019

    @blasten

    @GroovinChip would you mind following these steps #40213 (comment) and then paste the result here?

    Also run flutter build apk --no-proguard or flutter build appbundle --no-proguard

  10. GroovinChip commented on Sep 11, 2019

    @GroovinChip
    Contributor
  11. ezraaaa commented on Sep 12, 2019

    @ezraaaa
    Author

    Hey @blasten ,
    here are the files you requested

    android/gradle/wrapper/gradle-wrapper.properties

    #Fri Jun 23 08:50:38 CEST 2017
    distributionBase=GRADLE_USER_HOME
    distributionPath=wrapper/dists
    zipStoreBase=GRADLE_USER_HOME
    zipStorePath=wrapper/dists
    distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
    

    android/build.gradle

    buildscript {
        ext.kotlin_version = '1.3.31'
        repositories {
            google()
            jcenter()
        }
    
        dependencies {
            classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
            classpath 'com.android.tools.build:gradle:3.4.2'
            classpath 'com.google.gms:google-services:4.3.0'
        }
    }
    
    allprojects {
        repositories {
            google()
            jcenter()
        }
    }
    
    rootProject.buildDir = '../build'
    subprojects {
        project.buildDir = "${rootProject.buildDir}/${project.name}"
    }
    subprojects {
        project.evaluationDependsOn(':app')
    }
    
    task clean(type: Delete) {
        delete rootProject.buildDir
    }
    
  12. ezraaaa commented on Sep 12, 2019

    @ezraaaa
    Author

    @GroovinChip I constantly remove .gradle file whenever there is a change in distributionUrl or switching branch to get a fresh start with this command sudo rm -r ~/.gradle. Maybe you can try it out

  13. GroovinChip commented on Sep 12, 2019

    @GroovinChip
    Contributor

    @blasten I can try those commands now, will update shortly

  14. GroovinChip commented on Sep 12, 2019

    @GroovinChip
    Contributor

    @blasten here's the results of flutter build apk --no-proguard:

    You are building a fat APK that includes binaries for android-arm, android-arm64.
    If you are deploying the app to the Play Store, it's recommended to use app bundles or split the APK to reduce the APK size.
        To generate an app bundle, run:
            flutter build appbundle --target-platform android-arm,android-arm64
            Learn more on: https://developer.android.com/guide/app-bundle
        To split the APKs per ABI, run:
            flutter build apk --target-platform android-arm,android-arm64 --split-per-abi
            Learn more on:  https://developer.android.com/studio/build/configure-apk-splits#configure-abi-split
    Initializing gradle...                                              0.8s
    Resolving dependencies...                                          19.7s
    Calling mockable JAR artifact transform to create file: C:\Users\ReubenT\.gradle\caches\transforms-2\files-2.1\791359a83ea54a9d79172893a4311a86\android.jar with input C:\Users\ReubenT\AppData\Local\Android\sdk\platforms\android-29\android.jar
    Running Gradle task 'assembleRelease'...
    Running Gradle task 'assembleRelease'... Done                     108.0s
    Gradle task assembleRelease failed with exit code 1
    

    and here is the results of flutter build appbundle --no-proguard:

    Initializing gradle...                                              0.7s
    Resolving dependencies...                                           5.7s
    Running Gradle task 'bundleRelease'...
    Running Gradle task 'bundleRelease'... Done                         6.7s
    Gradle task bundleRelease failed with exit code 1
    

    I'll run in verbose mode shortly. In the meantime, here is my gradle-wrapper.properties:

    #Fri Jun 23 08:50:38 CEST 2017
    distributionBase=GRADLE_USER_HOME
    distributionPath=wrapper/dists
    zipStoreBase=GRADLE_USER_HOME
    zipStorePath=wrapper/dists
    distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
    

    and my app-level 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 from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
    
    def keystorePropertiesFile = rootProject.file('C:\\Users\\ReubenT\\FlutterProjects\\wishes\\android\\key.properties')
    def keystoreProperties = new Properties()
    if (keystorePropertiesFile.exists()) {
        keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
    }
    
    android {
        compileSdkVersion 29
    
        lintOptions {
            disable 'InvalidPackage'
        }
    
        defaultConfig {
            applicationId "com.devjam.wishes"
            minSdkVersion 16
            targetSdkVersion 29
            versionCode flutterVersionCode.toInteger()
            versionName flutterVersionName
            testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
            multiDexEnabled true
        }
    
        signingConfigs {
            release {
                keyAlias keystoreProperties['keyAlias']
                keyPassword keystoreProperties['keyPassword']
                storeFile file(keystoreProperties['storeFile'])
                storePassword keystoreProperties['storePassword']
            }
        }
    
        buildTypes {
            release {
                signingConfig signingConfigs.release
            }
        }
    }
    
    flutter {
        source '../..'
    }
    
    dependencies {
        testImplementation 'junit:junit:4.12'
        androidTestImplementation 'androidx.test:runner:1.1.1'
        androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
        implementation 'com.google.firebase:firebase-analytics:17.0.1'
        implementation 'com.google.android.gms:play-services-ads:18.2.0'
    }
    
    apply plugin: 'com.google.gms.google-services'
    
  15. GroovinChip commented on Sep 12, 2019

    @GroovinChip
    Contributor

    OK, here's the error from the end of flutter build appbundle --no-proguard -v:

    Gradle task bundleRelease failed with exit code 1
    
    #0      throwToolExit (package:flutter_tools/src/base/common.dart:28:3)
    #1      _buildGradleProjectV2 (package:flutter_tools/src/android/gradle.dart:801:5)
    <asynchronous suspension>
    #2      buildGradleProject (package:flutter_tools/src/android/gradle.dart:529:14)
    <asynchronous suspension>
    #3      _AndroidBuilderImpl.buildAab (package:flutter_tools/src/android/android_builder.dart:136:12)
    <asynchronous suspension>
    #4      BuildAppBundleCommand.runCommand (package:flutter_tools/src/commands/build_appbundle.dart:75:26)
    <asynchronous suspension>
    #5      FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:490:18)
    #6      _asyncThenWrapperHelper.<anonymous closure> (dart:async-patch/async_patch.dart:71:64)
    #7      _rootRunUnary (dart:async/zone.dart:1132:38)
    #8      _CustomZone.runUnary (dart:async/zone.dart:1029:19)
    #9      _FutureListener.handleValue (dart:async/future_impl.dart:137:18)
    #10     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:678:45)
    #11     Future._propagateToListeners (dart:async/future_impl.dart:707:32)
    #12     Future._completeWithValue (dart:async/future_impl.dart:522:5)
    #13     Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:552:7)
    #14     _rootRun (dart:async/zone.dart:1124:13)
    #15     _CustomZone.run (dart:async/zone.dart:1021:19)
    #16     _CustomZone.runGuarded (dart:async/zone.dart:923:7)
    #17     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:963:23)
    #18     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
    #19     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
    #20     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:116:13)
    #21     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:173:5)
    
  16. GroovinChip commented on Sep 12, 2019

    @GroovinChip
    Contributor

    Here's a full log of flutter build appbundle --no-proguard -v
    appbundle_noproguard_verbose.txt

  17. blasten commented on Sep 13, 2019

    @blasten

    @GroovinChip I can reproduce this on Gradle: 5.1.1 / Android Gradle plugin: 3.4.1. I would have a patch tomorrow, but for now try using Gradle: 4.10.2 / Android Gradle plugin: 3.2.1.

    android/gradle/wrapper/gradle-wrapper.properties:

    distributionBase=GRADLE_USER_HOME
    distributionPath=wrapper/dists
    zipStoreBase=GRADLE_USER_HOME
    zipStorePath=wrapper/dists
    distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
    
    

    android/gradle/build.gradle:

    buildscript {
        repositories {
            google()
            jcenter()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.2.1'
        }
    }
    
  18. github-actions commented on Aug 28, 2021

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  19. locked as resolved and limited conversation to collaborators on Aug 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

platform-androidAndroid applications specificallyt: gradle"flutter build" and "flutter run" on AndroidtoolAffects the "flutter" command-line tool. See also t: labels.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions