簡體   English   中英

flutter 應用程序未在 android 工作室中構建

[英]The flutter app does not build in android studio

我正在嘗試在 android 工作室中構建我的 flutter 應用程序,但出現以下錯誤。 不幸的是,谷歌未能發現其他開發者的這個錯誤。 我很高興聽到你的想法!

任務“:app:mapDebugSourceSetPaths”執行失敗。

評估任務“:app:mapDebugSourceSetPaths”的屬性“extraGeneratedResDir”時出錯無法計算任務“:app:mapDebugSourceSetPaths”屬性“extraGeneratedResDir”的值。 > 不支持在任務 ':app:processDebugGoogleServices' 完成之前查詢 provider(interface java.util.Set) 的映射值

這是 build.gradle(:app)

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 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"
apply plugin: 'com.google.gms.google-services'



android {
    compileSdkVersion 31

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = '1.8'
    }

    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.everybodytalks"
        minSdkVersion 16
        targetSdkVersion 31
        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
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    // Import the Firebase BoM
    implementation platform('com.google.firebase:firebase-bom:29.2.0')


} 

這是 build.gradle(:app)

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


    }

    dependencies {


        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.android.tools.build:gradle:7.3.0-alpha05'
        classpath 'com.google.gms:google-services:4.3.10'

    }
}

allprojects {
    repositories {
        google()
        mavenCentral()


    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
    project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

將它添加到你的android/app/build.gradle的底部

apply plugin: 'com.google.gms.google-services'

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM