【问题标题】:How to fix ERROR: No signature of method: build_ap86oam3dut3pxce3x49rdtma.android()?如何修复错误:没有方法签名:build_ap86oam3dut3pxce3x49rdtma.android()?
【发布时间】:2020-08-31 14:06:00
【问题描述】:

错误:没有方法签名:build_ap86oam3dut3pxce3x49rdtma.android() 适用于参数类型:(build_ap86oam3dut3pxce3x49rdtma$_run_closure1) 值:[build_ap86oam3dut3pxce3x49rdtma$_run_closure1@47588b04]

构建等级是:

apply plugin: 'com.android.application'

    android{
    implementationSdkVersion 28
    buildToolsVersion "29.0.3"
    defaultConfig {
        applicationId "com.uiresource.taksiku"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        }
    }

    dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        androidTestImplementation('com.android.support.test.espresso:espresso-core:2.3-alpha', {
            exclude group: 'com.android.support', module: 'support-annotations'
        })
        implementation "com.android.support:appcompat-v7:$var"
        implementation 'com.android.support:design:28.0.0'
        testimplementation 'junit:junit:4.13'
        implementation 'com.android.support.constraint:constraint-layout:2.0.0-beta5'
        implementation 'de.hdodenhof:circleimageview:3.1.0'
        }

【问题讨论】:

    标签: android android-studio kotlin


    【解决方案1】:

    如果您使用“dagger/Hilt”,则大多数情况下它缺少依赖项

    • 确保将其添加到项目级 build.graddle 中
       dependencies {
           // ....
            classpath "com.google.dagger:hilt-android-gradle-plugin:$hilt_version"
        
        }
    
    • 在应用级 build.graddle 中添加 hilt 插件
    plugins {
     //....
        id 'dagger.hilt.android.plugin'
    }
    
    • 添加完整的 hilt 和 dagger 依赖项
       //hilt
    
        implementation "com.google.dagger:hilt-android:$hilt_version"
    
        // Dagger Core 
        implementation "com.google.dagger:dagger:2.28"
        kapt "com.google.dagger:dagger-compiler:2.28"
    
        // Dagger Android
        api 'com.google.dagger:dagger-android:2.35.1'
        api 'com.google.dagger:dagger-android-support:2.31'
        kapt 'com.google.dagger:dagger-android-processor:2.31'
    
    //Dagger - Hilt
        implementation "com.google.dagger:hilt-android:2.32-alpha"
        kapt "com.google.dagger:hilt-android-compiler:2.28-alpha"
    

    【讨论】:

      【解决方案2】:

      对我来说,问题在于 Gradle 插件更新助手替换了这个:

      aaptOptions {
          noCompress "..."
      }
      

      有了这个:

      androidResources {
              noCompress '...'
      }
      

      撤消它,解决了构建错误。当然,这只是一种解决方法。

      【讨论】:

        【解决方案3】:

        对我来说,我在 项目 build.gradle 中将 firebase-crashlytics-gradle 从 2.5.2 更新到了 2.7.1,这导致了问题。

        dependencies {
            [...]
            classpath "com.google.firebase:firebase-crashlytics-gradle:2.7.1
        }
        

        我在我的 app 模块 build.grade 中删除了一个不必要的 firebaseCrashlytics 配置,然后它再次工作:

        // TODO this entire block had to be deleted to fix the issue
        firebaseCrashlytics {
            mappingFileUploadEnabled = false
        }
        

        【讨论】:

          【解决方案4】:

          这个问题在 Flutter 2.8 中很常见

          1. 删除包含C:\Users\LENOVO\.gradle的所有子文件夹的文件夹

          2. 转到 文件 菜单 > 设置 (Ctrl+Alt+S) 转到 外观和行为 > 系统设置 > Android SDK > SDK 工具选项卡 然后取消勾选Android SDK Build-ToolOK按钮 3)在Andriod Studio中运行项目(Shift+F10),它将从互联网上下载所有需要的文件并解决您的问题

          如果问题没有解决,那么第二步是:

          1. Go > android\app\build.gradle 在你的项目中 请添加 > minSdkVersion 19 or 20 // Remove it 因为,16 在 Flutter 2.8 中默认是 minSdkVersion //minSdkVersion flutter.minSdkVersion
          2. 如果文件大小超出限制,则添加 multiDexEnabled true

          【讨论】:

            【解决方案5】:

            今天我在制作签名apk时遇到了这个错误,并且在为playstore设置时犯了一个错误,在android/app/build.gradle中

            signingConfigs{
            debug{
             .....
             .....
            }
            release {....}  // I added the release config outside the signing config
            }
            

            Correct-way-todo-just-for-ref

            【讨论】:

              【解决方案6】:

              去掉这行,就可以了。

              includeCompileClasspath true

              【讨论】:

                猜你喜欢
                • 2021-09-13
                • 2022-09-24
                • 1970-01-01
                • 1970-01-01
                • 1970-01-01
                • 1970-01-01
                • 2021-07-31
                • 2019-08-08
                • 2015-07-20
                相关资源
                最近更新 更多