Bitrise How To Build Android Apps With Flutter Modules

I’m trying to build an Android app with a Flutter module. Unfortunately, Bitrise is unable to find the Flutter SDK and throws the following error:

Ensure required Android SDK components
Failed to ensure android components, error: output: FAILURE: Build failed with an exception.
* Where:
Build file '/bitrise/src/my_flutter/.android/Flutter/build.gradle' line: 13
* What went wrong:
A problem occurred evaluating project ':flutter'.
> Flutter SDK not found. Define location with flutter.sdk in the file.
* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Exception is:
org.gradle.api.GradleScriptException: A problem occurred evaluating project ':flutter'.

I’ve searched for Bitrise Flutter support and see that there is a Flutter plugin. How should I configure the Flutter plugin so it installs the Flutter SDK and Bitrise successfully builds my app?

Thanks for the help!

Hi @rayliverified!

You can always use our Install Flutter step which you can find from the Step Library in the Workflow Editor :slight_smile:

An easier solution, is to use one of our Hybrid Stacks, as Flutter is pre-installed there!

Could you walk me through how I should configure the Install Flutter step?
Here’s my Android app build workflow.

I assume that I should add Flutter before the Android SDK step which is where the current flow fails.

This is where I’m stuck. I don’t know what to put for the Flutter location because I’m not building a Flutter project but a Flutter module.

Thanks for taking a look!

– Can you link me to the Bitrise Hybrid Stack? I couldn’t find it!

If possible, please allow me to post more than 1 image at once. Having to split my images into multiple posts is not the best way to communicate. :confused:

Hi @rayliverified! I agree, but for this reason specifically, our on-site chat is a lot more suitable channel of communication for these kinds of topics. :slight_smile:

Anyhow, when you’re in your Workflow Editor, you can see a “Stacks” tab, which allows you to select one of our pre-defined environments, that’s what you’re looking for.

Actually, you will need the install missing tools step first to be able to build the app (if you need it at all)

1 Like

I’ll move the conversation to the on-site chat. I just thought posting the issue here might help future users with the same question.

I’m still running into the same issue even when running in a hybrid environment because Flutter requires you to define the SDK installation and I don’t know where Bitrise installs the Flutter SDK so I can’t configure it correctly.


Flutter SDK Location must be configured here. How can I configure it to the Bitrise Flutter SDK location?

Here’s my test repository:

I tried messaging through the website chat but did not receive a response. Please take a look as I’m blocked on this issue. Thanks!

It’s been over a week and I still don’t know how to build my project. I’m blocked on this issue so please help!

Sorry for the late reply, the issue was a little tricky
the problem was the hardcoded windows path to the flutter sdk in your file
if you could set the variable in the my_flutter/.android/Flutter/build.gradle line 11
instead of giving it the default value right away, you could check if (isCI == "true") then the path should be /usr/local/flutter/ else localProperties.getProperty(‘flutter.sdk’)

Maybe the better solution would be to remove this file from git index? should not be commited to the repo. It is generated when does not exist.
It is covered by rules in default .gitignore: **/android/

1 Like

this didn’t occur to me but would be a much easier solution I guess :upside_down_face: