当前位置: 首页 > 知识库问答 >
问题:

应用程序:编译应用程序flutter时出现CompileFlutterBuildreLease错误

涂玉韵
2023-03-14
    null

脚本'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle'行:838

  • 出了什么问题:

任务“:app:CompileFlutterBuildreLease”执行失败。

    null
    null

应用程序: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))
 }

 android {
     compileSdkVersion 28

sourceSets {
    main.java.srcDirs += 'src/main/kotlin'
}

lintOptions {
    disable 'InvalidPackage'
}

defaultConfig {
    applicationId "com.indianstore.onlineshopping"
    minSdkVersion 19
    targetSdkVersion 28
    versionCode flutterVersionCode.toInteger()
    versionName flutterVersionName
    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    multiDexEnabled true
    resConfigs "en"
}

signingConfigs {
    release {

        if (System.getenv()["CI"]) { // CI=true is exported by Codemagic
            storeFile file(System.getenv()["FCI_BUILD_DIR"] +      "/indianstorekey.jks")
            storePassword System.getenv()["FCI_KEYSTORE_PASSWORD"]
            keyAlias System.getenv()["FCI_KEY_ALIAS"]
            keyPassword System.getenv()["FCI_KEY_PASSWORD"]
        } else {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile file(keystoreProperties['storeFile'])
            storePassword keystoreProperties['storePassword']
        }
    }
     }

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.release
        shrinkResources true
        minifyEnabled true
        useProguard true

        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }

    debug {
        signingConfig signingConfigs.release
    }
     }
     compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
     }
 }

 flutter {
     source '../..'
 }

 dependencies {
     implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
     testImplementation 'junit:junit:4.12'
     androidTestImplementation 'androidx.test:runner:1.1.1'
     androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
     implementation 'com.android.support:multidex:1.0.3'


 }
 apply plugin: 'com.google.gms.google-services'
 googleServices { disableVersionCheck = true }

共有1个答案

司空奕
2023-03-14

也有同样的问题。通过flutter build appbundle-verbose,我找到了根本原因。它的基础是自定义图标,我很久以前就用http://fluttericon.com/创建了这些图标。

所以有3种可能的解决方案:

  1. 添加标志“--no-tree-shake-icons”
  2. 删除自定义图标
  3. 再次重新生成自定义图标
 类似资料:
  • 我是的新手,我正在尝试使用在eclipse上构建一个应用程序,我遵循了一个教程,并且做了完全相同的操作,该应用程序非常简单,当我试图编译它时,我得到了一堆我甚至不理解的错误: 你能告诉我我错过了什么吗。

  • 我在使用“创建反应应用程序”时遇到编译失败。我得到的信息如下。 __ ./src/App。未找到js模块:您试图导入/联系项目src/目录之外的内容。不支持src/之外的相对导入。您可以将其移动到src/内部,也可以从项目的节点_modules/向其添加符号链接。 __ 奇怪的是,我的src文件夹中肯定有“/联系人”文件,而消息说我没有。这是我的文件夹树。 这是我的应用程序。js代码。 感觉我在这

  • 我的应用程序正在正确编译,在我添加谷歌地图活动之前。然后我得到这个错误 build.gradle 有人能帮我解决这个问题吗。tnx

  • 以下是错误: 扑动医生输出: []Flutter(Channel stable,v1.7.8+Hotfix.4,在Linux上,locale en_IN)•Flutter版本1.7.8+Hotfix.4,在/home/sagar/development/Flutter•Framework修订版20E59316B8(两周前),2019-07-18 20:04:33-0700•Engine修订版fee

  • 当我连续发布数据时,我会在C#应用程序上得到发布超时错误,一旦我重新启动应用程序,它会工作几个小时。[注意:由于php需要时间完成任务,所以新的请求都在等待中,它创建队列,等待时间超过2分钟,im出现超时错误]。 我们的两台服务器都使用了最大50%的CPU和RAM使用量 我检查了两个C#代码和PHP代码都工作良好,没有任何问题或bug 提前致谢哥们儿:)

  • 我正在尝试通过gradle构建我的应用程序,在运行: 知道吗?