颤振的 build.gradle 应用程序错误

时间:2021-04-05 03:49:49

标签: flutter gradle build.gradle

我已经注释掉了:

apply plugin: 'kotlin-android'

androidExtensions{
    experimental = true
}

根据上一篇关于相同问题的建议,但无论如何它都会继续返回此错误。这是我的 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"


android {
    compileSdkVersion 29

    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.example.talk_app"
        minSdkVersion 23
        targetSdkVersion 29
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentalRunner "androidx.test.runner.AndroidUnitRunner"
        multiDexEnabled true
    }

    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
        }
    }
}

// androidExtensions{
//     experimental = true
// }

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.google.firebase:firebase-analytics'
    implementation 'com.android.support:multidex:1.0.3'
}
apply plugin: 'com.google.gms.google-services'

这是调试控制台上的错误:

FAILURE: Build failed with an exception.

* Where:
Build file 'E:\Work\Work\talk_app\android\app\build.gradle' line: 29

* What went wrong:
A problem occurred evaluating project ':app'.
> No signature of method: build_eo342ik7kf4kttl0as4y93aqc.android() is applicable for argument types: (build_eo342ik7kf4kttl0as4y93aqc$_run_closure2) values: [build_eo342ik7kf4kttl0as4y93aqc$_run_closure2@29804acb]

谁能就这个错误给出一些解决方案?尽快找到这个错误的解决方案对我来说非常有意义。

这是我的颤振版本:

Doctor summary (to see all details, run flutter doctor -v): 
[√] Flutter (Channel stable, 2.0.3, on Microsoft Windows [Version 10.0.19042.867], locale en-MY) 
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3) 
[√] Chrome - develop for the web 
[√] Android Studio (version 4.1.0) 
[√] VS Code (version 1.55.0) 
[√] Connected device (3 available) –

0 个答案:

没有答案
相关问题