2
votes

I have suddenly run into an error when debugging, it was just working and this error popped up when I tried loading a new screen in main.dart.

ERROR

Launching lib\main.dart on Android SDK built for x86 in debug mode...

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':app:processDebugResources'.

    Android resource linking failed Output: C:\LightBridge_Mobile\lightbridge_mobile\LightBridge\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:225: error: resource android:attr/fontVariationSettings not found. C:\LightBridge_Mobile\lightbridge_mobile\LightBridge\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:225: error: resource android:attr/ttcIndex not found. error: failed linking references.

    Command: C:\Users\Sam.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\a2fedb806fdcf1039dc8366793f0d803\aapt2-3.2.1-4818971-windows\aapt2.exe link -I\ C:\Users\Sam\AppData\Local\Android\sdk\platforms\android-27\android.jar\ --manifest\ C:\LightBridge_Mobile\lightbridge_mobile\LightBridge\build\app\intermediates\merged_manifests\debug\processDebugManifest\merged\AndroidManifest.xml\ -o\ C:\LightBridge_Mobile\lightbridge_mobile\LightBridge\build\app\intermediates\processed_res\debug\processDebugResources\out\resources-debug.ap_\ -R\ @C:\LightBridge_Mobile\lightbridge_mobile\LightBridge\build\app\intermediates\incremental\processDebugResources\resources-list-for-resources-debug.ap_.txt\ --auto-add-overlay\ --java\ C:\LightBridge_Mobile\lightbridge_mobile\LightBridge\build\app\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\ --custom-package\ com.example.lightbridgemobile\ -0\ apk\ --output-text-symbols\ C:\LightBridge_Mobile\lightbridge_mobile\LightBridge\build\app\intermediates\symbols\debug\R.txt\ --no-version-vectors Daemon: AAPT2 aapt2-3.2.1-4818971-windows Daemon #0 Output: C:\Users\Sam.gradle\caches\transforms-1\files-1.1\core-1.0.0.aar\44d43b22d49402bbb3cf830f8d41ead1\res\values\values.xml:89:5-125:25: AAPT: error: resource android:attr/fontVariationSettings not found.

    C:\Users\Sam.gradle\caches\transforms-1\files-1.1\core-1.0.0.aar\44d43b22d49402bbb3cf830f8d41ead1\res\values\values.xml:89:5-125:25: AAPT: error: resource android:attr/ttcIndex not found.

    error: failed linking references. Command: C:\Users\Sam.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\a2fedb806fdcf1039dc8366793f0d803\aapt2-3.2.1-4818971-windows\aapt2.exe link -I\ C:\Users\Sam\AppData\Local\Android\sdk\platforms\android-27\android.jar\ --manifest\ C:\LightBridge_Mobile\lightbridge_mobile\LightBridge\build\app\intermediates\merged_manifests\debug\processDebugManifest\merged\AndroidManifest.xml\ -o\ C:\LightBridge_Mobile\lightbridge_mobile\LightBridge\build\app\intermediates\processed_res\debug\processDebugResources\out\resources-debug.ap_\ -R\ @C:\LightBridge_Mobile\lightbridge_mobile\LightBridge\build\app\intermediates\incremental\processDebugResources\resources-list-for-resources-debug.ap_.txt\ --auto-add-overlay\ --java\ C:\LightBridge_Mobile\lightbridge_mobile\LightBridge\build\app\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\ --custom-package\ com.example.lightbridgemobile\ -0\ apk\ --output-text-symbols\ C:\LightBridge_Mobile\lightbridge_mobile\LightBridge\build\app\intermediates\symbols\debug\R.txt\ --no-version-vectors Daemon: AAPT2 aapt2-3.2.1-4818971-windows Daemon #0

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 18s


The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app.


Gradle task assembleDebug failed with exit code 1 Exited (sigterm)

2

2 Answers

1
votes

Copying my own answer from similar SO question (Android version no longer working after upgrading flutter packages)

I saw similar errors a few days ago, and found out I needed to upgrade my project to support AndroidX.

I was able to migrate flutter project to support AndroidX without having to use Android studio.

Here's what I did:

  1. updated compileSdkVersion in build.gradle file to 28
  2. and android.useAndroidX=true and android.enableJetifier=true in gradle.properties

EDIT: If you see Unable to merge dex error, see This SO post that has upvoted solutions including (1) try clean and rebuild OR (2) add following in app/build.gradle file:

android {
    defaultConfig {
       multiDexEnabled true
    }
}

Hope this helps!

0
votes

I was able to fix this by editing the compileSDK value. I changed it from 27 to 28.