0

I am trying to releas my app on play store and the command flutter build appbundle failed:

thi was the error:

Target aot_android_asset_bundle failed: IconTreeShakerException: ConstFinder failure: ../../Documents/FlutterDevelopment/SDKS/flutter/bin/cache/artifacts/engine/darwin-x64/const_finder.dart.snapshot: Error: Error when reading '../../Documents/FlutterDevelopment/SDKS/flutter/bin/cache/artifacts/engine/darwin-x64/const_finder.dart.snapshot': No such file or directory


To disable icon tree shaking, pass --no-tree-shake-icons to the requested flutter build command


FAILURE: Build failed with an exception.

* Where:
Script '/Users/***/Documents/FlutterDevelopment/SDKS/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 1157

* What went wrong:
Execution failed for task ':app:compileFlutterBuildRelease'.
> Process 'command '/Users/***/Documents/FlutterDevelopment/SDKS/flutter/bin/flutter'' finished with non-zero exit value 1

this is the key.properties:

keyAlias=upload storeFile=../app/upload-keystore.jks

And I have my upload-keystone.jks file in android/app

Here is the 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 flutter.compileSdkVersion
    ndkVersion flutter.ndkVersion

    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 "**"
        // You can update the following values to match your application needs.
        // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
        minSdkVersion flutter.minSdkVersion
        targetSdkVersion flutter.targetSdkVersion
        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"
}

I tried running flutte clean and flutter pub get before building but its the same result, I was flowing heyflutters youtube tutorial word for word.

1 Answer 1

0

I've faced same issue when I execute flutter build ios after removed /path/to/flutter/bin/cache/artifacts directory.

In my case, const_finder.dart.snapshot has been revived by execute flutter build ios after removed /path/to/flutter/bin/cache directory (not only /path/to/flutter/bin/cache/artifacts but entire /path/to/flutter/bin/cache.

Same solution described here:

https://github.com/flutter/flutter/issues/67153#issuecomment-1112562064

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.