Build error when update Flutter project to Gradle 4.1 on Android Studio 3.0.1
Solution 1
This is happening on me every time I do flutter clean
on a particular project.
My hack is to run (cd android/; ./gradlew flutterBuildX86Jar)
, which copies the missing file to the expected place.
Edit: Later I found out that the real problem was the order of the applied plugins. I added kotlin after creating project, and I need to apply kotlin plugin before flutter:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
Solution 2
Have you followed the steps outlined in Updating Flutter projects to Gradle 4.1 and Android Studio Gradle plugin 3.0.1?
Also, you probably have to upgrade your flutter install to 0.0.20
or later, if you haven't done that already.

grepLines
Updated on December 03, 2022Comments
-
grepLines 23 days
I have downloaded gradle v4.1 and I'm trying to update my Flutter app to use the new gradle version in Android Studio 3.0.1 However, I get the errors below:
Error:Could not resolve all files for configuration ':app:debugAndroidTestRuntimeClasspath'.
Failed to transform file 'flutter-x86.jar' to match attributes {artifactType=android-classes} using transform JarTransform Transform output file Git/samplegradle/build/app/intermediates/flutter/flutter-x86.jar does not exist.
EDIT - I followed this example to update
gradle 3.0.1
manually, and it works for me, although it takes longer. I still haven't found a solution to update it using Android Studio. -
grepLines almost 5 years@liro yes, I have update
Flutter
to the latest version, and also follow the instructions on how to install it through Android Studio. However, it doesn't work for me, so I ended up updategradle
manually (now it's working). -
Iiro Krankka almost 5 years@grepLines Could you self-answer this question then, with the steps how to solve it, if you got it working? This could be helpful for people googling the error and landing here. :)