-
Notifications
You must be signed in to change notification settings - Fork 536
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Xamarin.Android task cannot find NDK with latest Azure image(s) #7233
Comments
Did this start failing like last night? I have a build yesterday that did:
It is |
Started a new one, let's see what it does: https://dev.azure.com/jonathanpeppers/boots/_build/results?buildId=33&view=results |
Thanks for the response! Our builds started failing this morning, ones running yesterday were still using the old image, due to the staggered rollout. I do see your build is using MSBuild directly, whereas I'm using this badger for building my Xamarin Android project |
It seems like the bots should still have r23 and r24, can you add some |
Mine is also using |
Instead of the suggested mitigation of installing r21, is there a way to change the project to just use the latest version? I'm obviously having the same problem too. @jonathanpeppers, there's something here i dont understand. I dont think we're specifying the required NDK version in our manifest or csproj file, so what's causing it to use r21 specifically instead of just $LatestVersion. _ResolveMonoAndroidSdks: "/Users/runner/work/8/s/Mobile/CPSMobile/CPSMobile.Android/CPSMobile.Android.csproj" (PackageForAndroid target) (1) -> |
Context: dotnet/android#7233 Update `AndroidSdkBase.MaximumCompatibleNDKMajorVersion` to 25, so that NDK r25 is considered as a valid version.
I found something that prevents the selection of r25: dotnet/android-tools#190 Versions with Android NDK r24 or lower should work, though. As long as one of those is installed. |
According to https://github.com/actions/virtual-environments/blob/main/images/macos/macos-11-Readme.md, the following NDKs are installed. Wouldn't one of these be auto-selected? Or is there a configuration problem on my manfiest/csproj side? It just seems like a manual step shouldn't be necessary Edit: and on top of that, that list doesn't include r25. I'm not seeing how this would work, or I just have a fundamental misunderstanding of the implementation. :) |
Hey there, following the mitigation proposed in this thread, I've added this task prior to my Android build task and at least the NDK is now present.
This might not be an elegant permanent solution, since as @GreatBarrier86 stated, I also don't understand why 21.4.7075529 is not found automatically. However, this could help unblock those failing pipelines in the meantime at least. |
@DevenCC, did you have any success referencing a later version of the NDK that, according to that link, is also installed on the image? I tried doing the r24 and had no success. |
@GreatBarrier86 I tried the same task with 24.0.8215888 and it worked fine as well. For my specific needs however, I went for version 21.4.7075529 as that is what my project was using prior to this issue. |
I'm experiencing the same issue. This week we had one re-run on devops and that one magically succeeded while the previous one failed. All the builds after kept failing. The temp-fix from @DevenCC helps to get a successful build. |
Is someone able to share a You can build with |
@jonathanpeppers I tried to make one but I can't find where the binlog is placed. I copied the whole source and output directory but can't find it. |
Our App Center Xamarin.Forms Android builds just broke with the same error, too. We don't use any MSBuild task script or specify any specific NDK path/version in our Xamarin project. Things always built fine with just the source code in our DevOps repo. I wonder why it's not using whatever is the latest on the build agent after this update. Is there a setting in the Xamarin.Forms project that we have to configure? |
@mikequ-taggysoft look at the temporary fix from @DevenCC with |
@jtorvald We're not using Azure Pipelines for the project. We build it on-commit or manually via App Center which is connected to the repo. |
@mikequ-taggysoft sorry, I skipped over that. I guess you can do the same in AppCenter with a post-clone hook script and to add this line to it:
Documentation about post-clone hook can be found here |
@jtorvald Thanks! We do use post clone scripts and adding that command to it did resolve the issue. Is there any way to find out exactly which part of our Xamarin project depends on NDK v21 (or the Xamarin.Android framework itself does?) Is it possible to use the latest version somehow? |
Something else is strange here. I dont have any NDK version installed on my local build machine and i have no trouble building my app at all. If it works fine for me without the NDK, why is it necessary on the azure build machine? Is it something MacOS specific? Also, i agree with @mikequ-taggysoft. If we can eliminate the specific version requirement, that would be ideal. |
Are you building Debug or Release builds locally? only certain features of a Release build will need the NDK. |
This is what we define;
This is what was used which resulted in that error; |
@Maxgamerboy1 can you use this to get a msbuildArguments: -bl:$(Build.ArtifactStagingDirectory)msbuild.binlog Then save this file as an artifact, and share it? You might consider using the plain |
@jonathanpeppers i've emailed you a binlog from an errored build |
@jonathanpeppers, i shared the XamarinAndroidVersion above in this post here: #7233 (comment). Is that satisfactory to get what you need for this issue? Not the NDK one, but the issue of 2022 on macos-latest not supporting Android 13. It also occurs to me that my success with the NDK was on macos-latest. @Maxgamerboy1's issue was on windows 2022. |
@Maxgamerboy1 @GreatBarrier86 you both have Xamarin.Android 12.x, and you need to use 13.x. What Azure DevOps pool are you using? They supposedly rolled out an update that contains Xamarin.Android 13.x with: actions/runner-images#6045 |
Do you want a new log with @jonathanpeppers , this is the pool i'm using |
If you see Or we could reopen: actions/runner-images#6038 |
Whichever you think is best. |
@jonathanpeppers, do you recommend using the regular MSBuild task instead of Xamarin.Android? I created a new pipeline to develop Xamarin.Android and it put in both the Xamarin.Android step AND the MSBuild one. If we should be using the other one, that's fine, but it would be good to know. According to here, that task was last updated 2 months ago |
@jonathanpeppers I'm using the Azure Pipelines pool, running the macOS-latest image, specifically that errored build used image version 20220829.1. I changed to use the MSBuild task for my android project and it still fails to find the NDK, and it continues to resolve Xamarin.Android 12.0.0.3... Should we reopen that issue actions/runner-images#6038 |
@Maxgamerboy1, according to here (actions/runner-images#6038 (comment)), |
@GreatBarrier86 thanks for pointing that out, it works using macos-12! I'd be happy to mark this as resolved |
@Maxgamerboy1, any reason you're using the MSBuild task over the XamarinAndroid one? just curious myself. I'd like to use whichever one is recommended. |
@GreatBarrier86 no real reason, i'm seeing Pepper's builds making use of it, and with the revelation that we don't know who is maintaining that task, I think it's a smart move to hop over the MSBuild task |
@Maxgamerboy1, i'm not sure i agree that is unsupported, but i have no inside knowledge. According to GitHub, the Xamarin.Android task was just updated 2 months ago. I'm not sure if it's really "unsupported". Read what i wrote up here: #7233 (comment) |
I don't think I use the Personally, I don't see what value it has over the regular MSBuild task. If there is some value, we should just put that logic in Xamarin.Android/.NET 6 instead? |
Unless i misunderstand, he's saying he saw that you do NOT use Xamarin.Android, but instead use MSBuild. |
Yes, that's correct. Sorry for the confusion; XamarinAndroid task- I've stopped using, MSBuild task - I've now switched over to use :D |
Could someone post an example of how the MSBuild task should be configured to get the same result as this basic XamarinAndroid task? We are having the same problem and I don't really mind using one or the other as long as it works, but all the docs for Azure DevOps use the XamarinAndroid task, and I'm totally unfamiliar with the MSBuild task 😢 |
@salgiza sure! Although, see my response here #7233 (comment) the issue is relating more to the build image itself rather than the task used to build. to switch over, in your case, it should look something like this; - task: MSBuild@1
inputs:
solution: '**/*Droid*.csproj'
configuration: '$(buildConfiguration)'
msbuildArguments: '-p:OutDir="$(outputDirectory)" -t:SignAndroidPackage' |
Thanks a lot @Maxgamerboy1 , with all the messages in the thread, I had missed the one that said that changing the vmImage from macos-latest to macos-12 should fix the problem. Seeing the comments from @jonathanpeppers, though, I decided to do both (change the vmImage, and migrate from the XamarinAndroid task to MSBuild), and our pipeline is working again! |
Ok, so I think we've solved this one -- the Let me know if I missed anything outstanding here, thanks! |
@Maxgamerboy1, one thing I noticed, and I'm not sure what I should be using here, but the Xamarin.Android step's msbuild line shows |
Ah, sorry, didn't know you were doing signing in a separate step. Yes, you'll need to use the |
I certainly don't have to sign in a different step. Does the msbuild task also zipalign? If so, i don't see why i can't use the msbuild task for both. |
If using the
you'll also note prior to this step, MSBuild creates a debug keystore under the essentially, if you wanna zipalign and sign using your own keys, use |
@Maxgamerboy1, I'm leaving this here for anyone else that happens to run across this same question. You can pass in MSBuild arguments to sign the APK file, regardless of whether its your key or not. Maybe it will help someone in the future because i did need to research how to do this.
Taken from here: https://www.jenx.si/2020/04/05/xamarin-forms-developers-how-to-sign-android-apk/ |
Android application type
Classic Xamarin.Android (MonoAndroid12.0, etc.)
Affected platform version
Azure pipeline
Description
Making use of the Xamarin.Android task we have been able to build and deploy Xamarin.Android applications. New images were released which seems to have affected this task; the NDK path is no longer found when executing the "_ResolveMonoAndroidSdks" step resulting in a build failure.
Reviewing the latest releases for these images, I see there was work around NDK paths, symlinks, and environment variable changes.
actions/runner-images#5879
actions/runner-images#5930
The image we're using is
![Screenshot 2022-08-04 at 12 37 45](https://user-images.githubusercontent.com/25750702/182837912-a6b4aaaf-08a9-48a0-9027-aabb500f7d2d.png)
macOS-latest
, here are the old and new logs showing the "_ResolveMonoAndroidSdks" step resolving the NDK path:Old working image (20220724.1)
New broken image (20220801.1)
![Screenshot 2022-08-04 at 12 38 40](https://user-images.githubusercontent.com/25750702/182838071-be4977dd-12b8-4f63-bef4-812e20e945fe.png)
Do we know if the Xamarin.Android task needs to be updated to reflect this?
Steps to Reproduce
macOS-latest
image.error XA5104: Could not locate the Android NDK. Please make sure the Android NDK is installed in the Android SDK Manager, or if using a custom NDK path, please ensure the $(AndroidNdkDirectory) MSBuild property is set to the custom path.
Did you find any workaround?
No response
Relevant log output
No response
The text was updated successfully, but these errors were encountered: