app:compileFlutterBuildRelease 构建应用程序颤振时出错

shi*_*ani 7 android firebase android-studio flutter

在源代码中运行“flutter pub get”... 5.9 秒正在运行 Gradle 任务“bundleRelease”...
在字体中找不到代码点 58848,正在中止。

目标 aot_android_asset_bundle 失败:FontSubset 错误:字体子集设置失败,退出代码为 -1。

构建失败。

FAILURE:构建失败,出现异常。

  • 在哪里:

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

  • 什么地方出了错:

任务 ':app:compileFlutterBuildRelease' 执行失败。

进程 'command 'C:\src\flutter\bin\flutter.bat'' 以非零退出值 1 结束

  • 尝试:

使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获得更多日志输出。使用 --scan 运行以获得完整的见解。

BUILD FAILED in 2m 52s Running Gradle task 'bundleRelease'... 175.2s (!) Gradle 任务 bundleRelease 失败,退出代码 1 进程完成,退出代码 1

应用程序: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 }
Run Code Online (Sandbox Code Playgroud)

小智 8

遇到同样的问题。我找到flutter build appbundle --verbose了根本原因。它基于自定义图标,这是我很久以前使用http://fluttericon.com/构建的。

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

  1. 添加标志“--no-tree-shake-icons”
  2. 删除自定义图标
  3. 再次重新生成自定义图标

一切都会成功!


P4y*_*yam 1

我认为这一行显示了错误:

Codepoint 58848 not found in font, aborting.
Run Code Online (Sandbox Code Playgroud)

检查你的pubspec.yaml并看看这个错误是否来自任何库。另外,您的代码是否在调试模式下工作?您是否在 pubspec 文件中添加了任何字体?