4
votes

I have just created an app with flutter and I want to get the apks by splitting per abi. When given the command, there is a problem with configuring the plugin audioplayers.

I thought it could be a problem with using androidX?

Here is the error I get:

´´´ FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':audioplayers:verifyReleaseResources'.

    A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade Android resource linking failed C:\Users\vanda_qwkpv9x.gradle\caches\transforms-2\files-2.1\7faf2ad74a0b9932e38d86e684646e95\core-1.0.0\res\values\values.xml:57:5-88:25: AAPT: error: resource android:attr/fontVariationSettings not found.

    C:\Users\vanda_qwkpv9x.gradle\caches\transforms-2\files-2.1\7faf2ad74a0b9932e38d86e684646e95\core-1.0.0\res\values\values.xml:57:5-88:25: AAPT: error: resource android:attr/ttcIndex not found.

  • 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 56s Running Gradle task 'assembleRelease'... Running Gradle task 'assembleRelease'... Done 57.7s The built failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetfier to solve the incompatibility. Building plugin audioplayers... Running Gradle task 'assembleAarRelease'... Running Gradle task 'assembleAarRelease'... Done 2.0s

FAILURE: Build failed with an exception.

  • What went wrong: A problem occurred configuring root project 'audioplayers'.

    SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.

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

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

BUILD FAILED in 1s

The plugin audioplayers could not be built due to the issue above.


Anyone suggestions?
1
Welcome to Stack Overflow! Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Reproducible example.Богдан Опир
@FlutterMaster Did you solve the problem? If so, how?Siddhant

1 Answers

0
votes

EDIT: With newer Flutter projects (thus newer Gradle versions), android.enableR8 is deprecated!

I'm not an expert with Android nor Flutter, but after many tests it seems that the issue isn't related to a package your recently installed, but with the size of the build! I was getting errors related to audioplayers, assets_audio_player, multiple Firebase packages and so on.

In android\gradle.properties make sure you don't have android.enableR8 set to false.

Here were my issues and steps for those interested:

  1. I was only getting errors similar to yours only on build, not while using hot reload

  2. Errors were related to audioplayers which led me to think it's just a package issue

  3. Replaced it with assets_audio_player, but the problems continued

  4. Changed the order, but this made the error shift to Firebase. I recently added Craslytics and this made me think it's because I used a newer version compared to the 1-2 months old packages. I thought it was the time to upgrade to 8.x, but that didn't make sense either. Never had such issues with any FB service/

  5. Removed the latest sound packages, build was successful, but after adding more random packages (just to increase the size), the errors came back!

R8 announcement:

R8, the new code shrinker from Google, is available in Android studio 3.3 beta

Android developers know that APK size is an important factor in user engagement. Code shrinking helps reduce the size of your APK by getting rid of unused code and resources as well as making your actual code take less space (also known as minification or obfuscation).