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?
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.
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)
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.
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’)
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.