Bitrise How To Build Android Apps With Flutter Modules

android
#1

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
Retrying...
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 local.properties 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!

0 Likes

#2

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!

0 Likes

#3

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

0 Likes

#4

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

0 Likes

#5

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!

0 Likes

#6

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:

0 Likes

#7

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

#8

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.

0 Likes

#9

Error:

0 Likes

#10

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

0 Likes

#11

Here’s my test repository: https://github.com/searchy2/FlutterAndroid

0 Likes

#12

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!

0 Likes

#13

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!

0 Likes

#14

Sorry for the late reply, the issue was a little tricky
the problem was the hardcoded windows path to the flutter sdk in your local.properties 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’)

0 Likes

#15

Maybe the better solution would be to remove this file from git index?

local.properties should not be commited to the repo. It is generated when does not exist.
It is covered by rules in default .gitignore: **/android/local.properties.

1 Like

#16

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

0 Likes