How to fix ERROR: No signature of method: build_ap86oam3dut3pxce3x49rdtma.android()?

后端 未结 15 2151
野的像风
野的像风 2021-02-12 11:27

ERROR: No signature of method: build_ap86oam3dut3pxce3x49rdtma.android() is applicable for argument types: (build_ap86oam3dut3pxce3x49rdtma$_run_closure1) values: [build_ap86oam

相关标签:
15条回答
  • 2021-02-12 11:51

    I'm new to Android but i got a message similar to yours today when i try to use a different version (not the suggested ones) of the Gradle plugin and gradle engine on Android Studio 4.1 canary.

    When I had on my App build.gradle these lines:

    task wrapper(type: Wrapper){
        gradleVersion = '5.6.4'
    }
    

    and on my build.gradle for the module this line

    classpath 'com.android.tools.build:gradle:3.6.3' 
    

    This was the message i got with previous settings:

    A problem occurred evaluating project ':app'.
    > No signature of method: build_5dcjpn4h9nkpym0yszxs5w2uh.android() is applicable for argument types: (build_5dcjpn4h9nkpym0yszxs5w2uh$_run_closure1) values: [build_5dcjpn4h9nkpym0yszxs5w2uh$_run_closure1@2e4515b3]
    

    The way i found to solve this error was changing version for the gradle plugin on my build.gradle for the module like this

    classpath 'com.android.tools.build:gradle:4.0.0' 
    

    I hope this could help you. Happy coding!

    0 讨论(0)
  • 2021-02-12 11:53

    Old issue but worth noting you might need to follow the migration guide here if you see this issue:

    https://developer.android.com/topic/libraries/view-binding/migration

    For me, removing the line apply plugin: 'kotlin-android-extensions' and adding view binding as below resolved the issue:

    buildFeatures {
        viewBinding true
    }
    
    0 讨论(0)
  • 2021-02-12 11:54

    I had a similar issue because I had added a trailing comma , in defaultConfig in android/app/build.gradle

    0 讨论(0)
  • 2021-02-12 11:54

    I was getting a similar error because the versionCode was being taken from a properties file, but the versionCode needs to be an integer and not a string, so toInteger() was needed.

    Nice logs, android.

    0 讨论(0)
  • 2021-02-12 11:55

    I had the same error message until I commented out everything in the android plugin except the compile sdk version, trying to get back to a successful build config.

    android {
        compileSdkVersion 23
    /*
        ...
    */
    }
    

    Then, I started uncommenting things until I narrowed the problem down to using the following incorrectly.

    ProductFlavors {
      ...
    }
    

    I'm not sure if you're using the same block, but at the moment, I'm leaving it commented out because I'm not sure it's needed. Once I got rid of it though, I was receiving other errors about sdk root dir location, so I was able to fix those.

    I hope this helps!

    0 讨论(0)
  • 2021-02-12 11:58

    If you are using kotlin version 1.4.21 or newer, kotlin-android-extension is deprecated. So if you removing the plugin you also have to remove the android experimental extension block. In my case, I had to remove these pieces of code.

    apply plugin: 'kotlin-android-extensions'
    
    
    androidExtensions {
        experimental = true
    }
    
    0 讨论(0)
提交回复
热议问题