hey24sheep / azure-flutter-tasks

Easily build and deploy with latest Flutter build tasks for Azure DevOps Pipelines Tasks
https://marketplace.visualstudio.com/items?itemName=Hey24sheep.flutter
MIT License
89 stars 22 forks source link

Flutter Build will fetch and cache Android SDK on linux but not on Windows #107

Closed sk92129 closed 10 months ago

sk92129 commented 10 months ago

When I build the flutter app on the linux cloud image, it would fetch the android SDK and tools to build the android apk (flutter build apk --flavour prod). However, when I run the same flutter build command on a Windows onsite agent, it failed because it cannot find the Android SDK.

sk92129 commented 10 months ago

Starting: FlutterBuild

Task : Flutter Build Task Description : Build a Flutter application project. Version : 0.3.10 Author : Hey24sheep Help : More Information

C:\Windows\system32\cmd.exe /D /S /C "D:\BuildAgentMobileWeb_work_tool\Flutter\3.16.3\windows\flutter\bin\flutter.bat build apk "--flavor=prod" "--target=lib/main.dart"" Resolving dependencies... _fe_analyzer_shared 64.0.0 (65.0.0 available) analyzer 6.2.0 (6.3.0 available) connectivity_plus 4.0.2 (5.0.2 available) flutter_lints 2.0.3 (3.0.1 available) go_router 12.1.3 (13.0.1 available) intl 0.18.1 (0.19.0 available) js 0.6.7 (0.7.0 available) lints 2.1.1 (3.0.0 available) matcher 0.12.16 (0.12.16+1 available) material_color_utilities 0.5.0 (0.8.0 available) meta 1.10.0 (1.11.0 available) path 1.8.3 (1.9.0 available) test 1.24.9 (1.25.0 available) test_api 0.6.1 (0.7.0 available) test_core 0.5.9 (0.6.0 available) vm_service 13.0.0 (14.0.0 available) web 0.3.0 (0.4.0 available) web_socket_channel 2.4.0 (2.4.3 available) Got dependencies! 18 packages have newer versions incompatible with dependency constraints. Try flutter pub outdated for more information. [!] No Android SDK found. Try setting the ANDROID_SDK_ROOT environment variable.

[error]Error: The process 'D:\BuildAgentMobileWeb_work_tool\Flutter\3.16.3\windows\flutter\bin\flutter.bat' failed with exit code 1

Finishing: FlutterBuild

hey24sheep commented 10 months ago

Are you doing Flutter Install on your windows agent? If not, then you will have to do it.

sk92129 commented 10 months ago

Yes, the flutter tools are running on a windows agent.

hey24sheep commented 10 months ago

I think you are using a local build agent. This issue is with your pipeline environment and not related to this extension. It will be better to look at closed issues here or check on stackoverflow

You can also check this Stackoverflow issue

sk92129 commented 10 months ago

Yes, I am using an on-site Windows agent rather than a cloud agent. The only thing I change is the specifying a pool to run it on my onsite Windows agent. If I remove the pool on the yaml, then the cloud linux agent is automatically triggered to run the job. When it runs on the linux cloud agent, it will download the android sdk. But if I specify the windows on-prem agent, then it will fail because it does not download the android sdk but expects it to be pre-installed and is looking for the ANDROID_SDK_ROOT.

hey24sheep commented 10 months ago

@sk92129 It won't download the Android SDK for you. You will have to do it and setup everything. On "Hosted Agents", it already has these things preinstalled. On local agents you will have to setup these things.

I am closing this issue as the issue is related to pipelines and not with this extension, which you can solve by simply googling or asking on StackOverflow.