Repository navigation
Description
Steps to Reproduce
- Checkout this branch
- Run
./build.sh
The actual msbuild command is:
msbuild /p:Configuration=Release /p:AndroidBuildApplicationPackage=true /t:Clean\;Build\;SignAndroidPackage /p:AndroidSdkDirectory=/usr/local/share/android-sdk/build-tools/
That means, with or without
/p:AndroidSdkDirectory=I get the same error. Ideally the error message would change once/p:AndroidSdkDirectory=is provided to indicate the parameter was correctly accepted, but the path rejected.
Expected Behavior
Builds. It does on my local macOS but it fails on Travis-CI macOS build.
Actual Behavior
On travis, even after installing all dependencies (I have a debug session attached there right now) it fails to find the Android SDK.
Log File
relevant output from diag msbuild:
Using "ResolveSdks" task from assembly "/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Build.Tasks.dll".
Task "ResolveSdks" (TaskId:66)
Task Parameter:ReferenceAssemblyPaths=/Library/Frameworks/Mono.framework/External/xbuild-frameworks/MonoAndroid/v1.0/ (TaskId:66)
ValidateAndroidSdkLocation: `/usr/local/share/android-sdk`, result=False (TaskId:66)
ValidateAndroidSdkLocation: ``, result=False (TaskId:66)
ValidateAndroidSdkLocation: `/usr/local/share/android-sdk`, result=False (TaskId:66)
ValidateAndroidSdkLocation: `/Users/travis/Library/Android/sdk`, result=False (TaskId:66)
ValidateAndroidNdkLocation: ``, result=False (TaskId:66)
ValidateJavaSdkLocation: ``, result=False (TaskId:66)
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(798,2): error XA5300: The Android SDK Directory could not be found. Please set via /p:AndroidSdkDirectory. [/Users/travis/build/getsentry/sy
mbol-collector/src/SymbolCollector.Android/SymbolCollector.Android.csproj]
Output Property: MonoAndroidToolsDirectory=/Library/Frameworks/Xamarin.Android.framework/Versions/9.4.1.0/lib/xamarin.android/xbuild/Xamarin/Android (TaskId:66)
Output Property: MonoAndroidBinDirectory=/Library/Frameworks/Xamarin.Android.framework/Versions/9.4.1.0/lib/xamarin.android/xbuild/Xamarin/Android/Darwin/ (TaskId:66)
Done executing task "ResolveSdks" -- FAILED. (TaskId:66)
Done building target "_ResolveSdks" in project "SymbolCollector.Android.csproj" -- FAILED.: (TargetId:44)
Done Building Project "/Users/travis/build/getsentry/symbol-collector/src/SymbolCollector.Android/SymbolCollector.Android.csproj" (Clean;Build;SignAndroidPackage target(s)) -- FAILED.
Deferred Messages
The path it rejected is:
Traviss-Mac:SymbolCollector.Android travis$ ls -lah /usr/local/share/android-sdk
lrwxr-xr-x 1 travis admin 39B Dec 5 21:48 /usr/local/share/android-sdk -> /usr/local/Caskroom/android-sdk/4333796
Traviss-Mac:SymbolCollector.Android travis$
..
Traviss-Mac:SymbolCollector.Android travis$ ls -lah /usr/local/share/android-sdk/
total 8
drwxr-xr-x@ 7 travis admin 224B Dec 5 21:50 .
drwxr-xr-x 4 travis admin 128B Dec 5 21:48 ..
-rw-r--r-- 1 travis admin 16B Dec 5 21:50 .knownPackages
drwxr-xr-x 3 travis admin 96B Dec 5 21:51 build-tools
drwxr-xr-x 10 travis admin 320B Dec 5 21:50 licenses
drwxr-xr-x 3 travis admin 96B Dec 5 21:50 platforms
drwxr-xr-x@ 14 travis staff 448B Dec 5 21:50 tools
# there I have the tools I expect:
Traviss-Mac:SymbolCollector.Android travis$ ls -lah /usr/local/share/android-sdk/
.knownPackages build-tools/ licenses/ platforms/ tools/
Traviss-Mac:SymbolCollector.Android travis$ ls -lah /usr/local/share/android-sdk/build-tools/
drwxr-xr-x 29 travis staff 928B Dec 5 21:51 29.0.2
# and platform:
Traviss-Mac:SymbolCollector.Android travis$ ls -lah /usr/local/share/android-sdk/platforms/
total 0
drwxr-xr-x 3 travis admin 96B Dec 5 21:50 .
drwxr-xr-x@ 7 travis admin 224B Dec 5 21:50 ..
drwxr-xr-x 14 travis staff 448B Dec 5 21:50 android-29
Traviss-Mac:SymbolCollector.Android travis$
# I also have some env vars, to debug this:
Traviss-Mac:SymbolCollector.Android travis$ echo $ANDROID_SDK_ROOT
/usr/local/share/android-sdk
Traviss-Mac:SymbolCollector.Android travis$ echo $ANDROID_HOME
/usr/local/share/android-sdk
I tried creating the config file as discussed in #1481
Traviss-Mac:SymbolCollector.Android travis$ cat ~/.config/xbuild/monodroid-config.xml
<?xml version="1.0" encoding="utf-8"?>
<monodroid>
<android-sdk path="/usr/local/share/android-sdk" />
</monodroid>
But that didn't help. Now that I see the log diagnostic I see the path is tested by msbuild, but I'm not sure why it's being rejected.
Version Information
Traviss-Mac:SymbolCollector.Android travis$ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home
Traviss-Mac:SymbolCollector.Android travis$ java -version
openjdk version "1.8.0_232"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_232-b09)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.232-b09, mixed mode)
Traviss-Mac:SymbolCollector.Android travis$ dotnet --version
3.0.100
Traviss-Mac:SymbolCollector.Android travis$ mono --version
Mono JIT compiler version 6.0.0.334 (2019-02/6256b82d62f Tue Sep 3 17:44:33 EDT 2019)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS:
SIGSEGV: altstack
Notification: kqueue
Architecture: amd64
Disabled: none
Misc: softdebug
Interpreter: yes
LLVM: yes(600)
Suspend: hybrid
GC: sgen (concurrent by default)
Traviss-Mac:SymbolCollector.Android travis$ msbuild
Microsoft (R) Build Engine version 16.1.85+gad9c9926a7 for Mono
Copyright (C) Microsoft Corporation. All rights reserved.
Traviss-Mac:SymbolCollector.Android travis$ uname -a
Darwin Traviss-Mac.local 18.5.0 Darwin Kernel Version 18.5.0: Mon Mar 11 20:40:32 PDT 2019; root:xnu-4903.251.3~3/RELEASE_X86_64 x86_64
I'm not sure why MSBuild ignores the path /usr/local/share/android-sdk/. I've tried a ton of stuff and basically I can't get this to build on Travis.
Any pointers appreciated.
To certain degree it's as #2979 although that had no detail if the path was being considered or not. With the logs here we can see msbuild takes the path, it tests it, but rejects it. I wonder what am I doing wrong. Or if there's an issue.
Activity
[-]error XA5300: The Android SDK Directory could not be found. Please set via /p:AndroidSdkDirectory.[/-][+]Travis-CI: error XA5300: The Android SDK Directory could not be found. Please set via /p:AndroidSdkDirectory.[/+]dellis1972 commentedon Dec 6, 2019
This argument
I think should just be
i.e the root of the
android-sdkrather than the build-tools. We use this property to look up files in other parts of the sdk,not just build-tools. (i.e the platforms folders, tools and platform-tools)dellis1972 commentedon Dec 6, 2019
Rather than having travis install the android-sdk you could try our
InstallAndroidDependenciestarget. For example.This will download only the required parts of the Android SDK needed to build the app.
bruno-garcia commentedon Dec 6, 2019
@dellis1972
I've tried
/usr/local/share/android-sdk/everywhere (I'm awake this is the right path).When I ran out of ideas I tried to specify more specific paths like
/build-tools/platforms/.This is really helpful! Thank you. I'll try this one out.
bruno-garcia commentedon Dec 6, 2019
@dellis1972 I've tried as you suggested:
getsentry/symbol-collector@15d89ed...8346d98
Which worked locally (I can see the deps getting installed), but on Travis, I got the same error:
https://travis-ci.com/getsentry/symbol-collector/builds/139694092
Any other suggestion I could try?
jonathanpeppers commentedon Dec 6, 2019
I don't see what the Xamarin.Android version you're running on Travis. Your
/v:diaglog should show aXamarinAndroidVersionproperty, what does it print?bruno-garcia commentedon Dec 6, 2019
@jonathanpeppers Sorry the delay:
XamarinAndroidVersion = 9.4.1-0I used:
boots 1.0.1.386Is that the issue? I'm targeting (or trying) API 29 everywhere:
The right branch:
https://github.com/getsentry/symbol-collector/blob/fix/travis/src/SymbolCollector.Android/SymbolCollector.Android.csproj#L19
https://github.com/getsentry/symbol-collector/blob/fix/travis/src/SymbolCollector.Android/Properties/AndroidManifest.xml#L3
And that's why I'm installing Android SDK build tools 29.0.2 and platforms 29:
https://github.com/getsentry/symbol-collector/blob/feat/travis/.travis.yml#L41-L42
dellis1972 commentedon Dec 6, 2019
Try including the
/p:AndroidSdkDirectoryargument but set it to a location within the build tree.eg.
bruno-garcia commentedon Dec 6, 2019
I have. Following the advise from the error message was the first thing I did. After that was a bunch of random tries and nothing changes the error message. It's part of the issue description, I've set it as env var, I passed as a parameter, etc.
In the description there's a diag log which shows it tested the path but it says
Falsebut not why.Do I have the wrong tool version? What's going on?
Running again now (I have an SSH session again with the build agent):
msbuild -v:diag /p:Configuration=Release /p:AndroidBuildApplicationPackage=true /t:InstallAndroidDependencies\;Clean\;Build\;SignAndroidPackage /p:AndroidSdkDirectory=/usr/local/share/android-sdkStill:
Or a bigger part, which shoes the path was considered:
bruno-garcia commentedon Dec 6, 2019
Interestingly, the link from
boots(https://aka.ms/xamarin-android-commercial-d16-4-windows) redirects to:Xamarin.Android.Sdk-10.1.0.30.vsixSo it does look like Xamarin Android SDK 10.dellis1972 commentedon Dec 6, 2019
Can you try running the
InstallAndroidDependenciesas a separate msbuild call rather thanInstallAndroidDependencies;Clean;Build?I found msbuild can behave oddly when calling all the targets in the same "session".
7 remaining items
dellis1972 commentedon Dec 7, 2019
according to the docs android components stuff is only supported on Trusty :( https://docs.travis-ci.com/user/languages/android/#overview...
bruno-garcia commentedon Dec 7, 2019
@dellis1972 I'm aware. build type android is a :inux box. But I need this built on macOS so I installed things myself. So the files are there, why would Xamarin not be able to find it.
It's possible to SSH into the agent to troubleshoot if that helps.
If I can use the switch to get it to work (will install all dependencies etc) that also does the job and we can move on but at this point I just wanted to know :)
dellis1972 commentedon Dec 7, 2019
this is the problem #4003
bruno-garcia commentedon Dec 7, 2019
@dellis1972 is that something I can override at my
csprojto test it out?dellis1972 commentedon Dec 8, 2019
@bruno-garcia I think I got it working using the script at https://github.com/journeyapps/android-sdk-installer.
You can check out my script at https://github.com/dellis1972/HelloForms/blob/master/.travis.yml.
I had a similar problem to you when using the script above, until I realised that it did NOT install the sdk tooling in to the root of the
./android-sdk/directory but into a./android-sdk/android-sdk-macosxsubdirectory. This is why our tooling (which looks foradbin a specific location) did not think it was valid. I suspect you are having a similar issue, if you add afind /usr/local/share/android-sdk | grep adbto your script you might see whereadbis actually being installed then use the right path. In my case it was ending up inbut we were expecting it in
which is why the path we were passing was not working.
[Xamarin.Android.Build.Tasks] fix installing the SDK if one doesn't e…
bruno-garcia commentedon Dec 10, 2019
Thanks a lot @dellis1972 helping troubleshoot this.
[Xamarin.Android.Build.Tasks] fix installing the SDK if one doesn't e…
brendanzagaeski commentedon Jan 23, 2020
Release status update
A new Preview version has now been published that includes the fix for this item. The fix is not yet included in a Release version. I will update this item again when a Release version is available that includes the fix.
Fix included in Xamarin.Android 10.2.0.84.
Fix included on Windows in Visual Studio 2019 version 16.5 Preview 2. To try the Preview version that includes the fix, check for the latest updates in Visual Studio Preview.
Fix included on macOS in Visual Studio 2019 for Mac version 8.5 Preview 1. To try the Preview version that includes the fix, check for the latest updates on the Preview updater channel.
brendanzagaeski commentedon Mar 17, 2020
Release status update
A new Release version has now been published on Windows that includes the fix for this item. The fix is not yet published in a Release version on macOS. I will update this item again when a Release version is available on macOS that includes the fix.
Fix included in Xamarin.Android 10.2.0.100.
Fix included on Windows in Visual Studio 2019 version 16.5. To get the new version that includes the fix, check for the latest updates or install the latest version from https://visualstudio.microsoft.com/downloads/.
(Fix also included on macOS in Visual Studio 2019 for Mac version 8.5 Preview 1 and higher. To try the Preview version that includes the fix, check for the latest updates on the Preview updater channel.)
brendanzagaeski commentedon Mar 24, 2020
Release status update
A new Release version has now been published on macOS that includes the fix for this item.
Fix included in Xamarin.Android 10.2.0.100.
Fix included on macOS in Visual Studio 2019 for Mac version 8.5. To get the new version that includes the fix, check for the latest updates on the Stable updater channel.
(Fix also included on Windows in Visual Studio 2019 version 16.5 and higher. To get the new version that includes the fix, check for the latest updates or install the latest version from https://visualstudio.microsoft.com/downloads/.)