gpt4 book ai didi

android - Flutter 构建 Appbundle 错误 :* What went wrong: A problem occurred evaluating project ':app'

转载 作者:行者123 更新时间:2023-12-04 23:36:20 27 4
gpt4 key购买 nike

这是我尝试在终端中运行“flutter build appbundle”时遇到的错误。
我已经在寻找一些解决方案,但没有一个与我得到的错误相同
FAILURE:构建失败并出现异常。

  • 在哪里:
    构建文件 'C:\Users\User_Name\Desktop\deploy\bahetra\android\app\build.gradle' 行:31
  • 什么地方出了错:
    评估项目 ':app' 时出现问题。

  • Malformed \uxxxx encoding.


    这是我的“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)) // line 31
    }

    android {
    compileSdkVersion 30

    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.bahetra"
    minSdkVersion 16
    targetSdkVersion 30
    versionCode flutterVersionCode.toInteger()
    versionName flutterVersionName
    }

    signingConfigs {
    release {
    keyAlias keystoreProperties['keyAlias']
    keyPassword keystoreProperties['keyPassword']
    storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
    storePassword keystoreProperties['storePassword']
    }
    }
    buildTypes {
    release {
    signingConfig signingConfigs.release
    }
    }
    }

    flutter {
    source '../..'
    }

    dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    }

    最佳答案

    问题在 key.properties 文件中。用正斜杠替换存储位置中的所有反斜杠,它应该可以工作。例如:
    在 key.properties 文件中更新它:

    storeFile= C:\Users\<user name>\upload-keystore.jks
    对此: storeFile=C:/Users/<user name>/upload-keystore.jks

    关于android - Flutter 构建 Appbundle 错误 :* What went wrong: A problem occurred evaluating project ':app' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67471948/

    27 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com