ByneappLLC / flutter_config

Config Variables for your Flutter Apps.
BSD 2-Clause "Simplified" License
148 stars 66 forks source link

:flutter_config not found in new gradle builds #47

Closed flodaniel closed 1 year ago

flodaniel commented 2 years ago

When using a CI/CD tool such as codemagic, the build is often split in a different way compared to when we do a classic flutter build. For the flutter pipeline in codemagic, the codemagic CLI first runs a flutter pub get followed right away with a /Users/builder/programs/gradle-7.3.1/bin/gradle wrapper --gradle-version 6.9.1 --distribution-type all.

This causes the following issue:

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/builder/clone/android/app/build.gradle' line: 35

* What went wrong:
A problem occurred evaluating project ':app'.
> Project with path ':flutter_config' could not be found in project ':app'.

I can reproduce it locally be running:

  1. flutter clean
  2. cd android
  3. gradle wrapper --gradle-version 6.9.1 --distribution-type all

Triaging the error shows that the absence of the file .flutter-plugins-dependencies causes the issue. More specifially the following lines in the plugins --> android array of the file:

{ "name": "flutter_config", "path": "/Users/floriandaniel/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_config-2.0.0/", "dependencies": [] },

So another way to reproduce the error is the following way:

  1. run your normal flutter build e.g. flutter build apk
  2. delete the lines shown above from the file .flutter-plugins-dependencies
  3. try to run gradle wrapper --gradle-version 6.9.1 --distribution-type all again in the android folder

Sadly I do not yet have a proper solution for this. I am wondering if i should just commit the .flutter-plugin-dependencies, but i am 1) not sure if this would resolve the issue as on codemagic it might not be read and 2) i am sure this would be a hacky workaround.

Flutter: 2.8.1

MuTe33 commented 2 years ago

Hey, just faced the same issue today. Haven't run my build for a longer time. Any updates on how to resolve this? Much appreciated! @flodaniel

mario-jerkovic commented 2 years ago

@edTheGuy00 is there any progress on this issue? thanks

edTheGuy00 commented 1 year ago

Closed with #57