3

Currently our Flutter builds on MS Appcenter are failing with the following logs:

* What went wrong:
Execution failed for task ':appcenter_analytics:verifyReleaseResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > Android resource linking failed
     /Users/runner/.gradle/caches/transforms-2/files-2.1/4bf813c12249ada6f409527e3c5fd194/core-1.0.0/res/values/values.xml:57:5-88:25: AAPT: error: resource android:attr/fontVariationSettings not found.

     /Users/runner/.gradle/caches/transforms-2/files-2.1/4bf813c12249ada6f409527e3c5fd194/core-1.0.0/res/values/values.xml:57:5-88:25: AAPT: error: resource android:attr/ttcIndex not found.

This problem cannot be reproduced locally, there everything works fine. Only the build in Appcenter is failing.

Most of the answers around this problem seem to be about the compileSdkVersion, which in our project was already at 28, I have even tried to change it to 29 to no avail. I have set-up a completely new pipeline in Appcenter, same result. I have changed flutter versions, same result. Flutter doctor output in the appcenter:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.12.13+hotfix.8, on Mac OS X 10.14.6 18G3020, locale en)
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    ! Some Android licenses not accepted.  To resolve this, run: flutter doctor --android-licenses
[✓] Xcode - develop for iOS and macOS (Xcode 11.3.1)
[!] Android Studio (not installed)
[!] Connected device
    ! No devices available

! Doctor found issues in 3 categories.
+ flutter build apk --release
Running "flutter pub get" in s...                                  11.6s
You are building a fat APK that includes binaries for android-arm, android-arm64, android-x64.
If you are deploying the app to the Play Store, it's recommended to use app bundles or split the APK to reduce the APK size.
    To generate an app bundle, run:
        flutter build appbundle --target-platform android-arm,android-arm64,android-x64
        Learn more on: https://developer.android.com/guide/app-bundle
    To split the APKs per ABI, run:
        flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi
        Learn more on:  https://developer.android.com/studio/build/configure-apk-splits#configure-abi-split
Running Gradle task 'assembleRelease'...                        
Gradle 5.6.4

Thanks!

kiwiidb
  • 331
  • 2
  • 10

2 Answers2

2

I had a similar issue and was related to a plugin that doesn't have the recent compile SDK version. You can force that by changing the andoid/build.gradle file and include something like

subprojects {
    afterEvaluate { project ->
        if (project.name == "plugin_that_causes_the_issue") {
            android {
                compileSdkVersion 28
            }
        }
    }
}
Bernhard
  • 8,583
  • 4
  • 41
  • 42
0

I'm getting the same error while building the flutter App.

  • Open Project structure (File -> Project Structure).
  • then in Project SDK select Android API 29 platform.
  • Click Ok

It will solve the problem if not then open Android Module in Android Studio (Tools -> Flutter -> Open for editing in Android Studio). and try to build apk from build

Shailendra Rajput
  • 2,131
  • 17
  • 26