xamarin / AndroidX

AndroidX bindings for .NET for Android
MIT License
179 stars 45 forks source link

Unable to download xamarin dependency from dl.google.com / maven.google.com #687

Open SlevenRobbert01 opened 1 year ago

SlevenRobbert01 commented 1 year ago

Android application type

Classic Xamarin.Android (MonoAndroid12.0, etc.)

Affected platform version

VS22 v17.4.2

Description

XamarinBuildDownloadCore is unable to download firebasecomponents. it seems it ignores the configured proxy settings. it does not listen to http_proxy & https_proxy

The Nuget packages are added correctly, but when building it tries to download missing components.

_XamarinBuildDownloadCore:
  Downloading https://dl.google.com/dl/android/maven2/com/google/firebase/firebase-components/17.0.1/firebase-components-17.0.1.aar to /Users/{USER}/Library/Caches/XamarinBuildDownload/firebasecomponents-17.0.1.aar
  Download failure reason: Error: ConnectFailure (No route to host)
/Users/{USER}/{PROJ}/packages/Xamarin.Build.Download.0.11.3/build/Xamarin.Build.Download.targets(52,3): error XBD001: Download failed. Please download https://dl.google.com/dl/android/maven2/com/google/firebase/firebase-components/17.0.1/firebase-components-17.0.1.aar to file ...

Steps to Reproduce

Did you find any workaround?

No response

Relevant log output

No response

dellis1972 commented 1 year ago

Transferred this issue to where the XamarinBuildDownload source code it stored. Since this will need to be fixed in the Nuget Package.

jpobst commented 1 year ago

Do you have any experience writing code that can interact with proxies correctly? We currently use WebClient to perform the download:

https://github.com/xamarin/AndroidX/blob/main/util/Xamarin.Build.Download/source/Xamarin.Build.Download/XamarinDownloadArchives.cs#L171

dellis1972 commented 1 year ago

The Internet say this should work to pick up the default proxy

var wp = WebRequest.DefaultWebProxy;
wp.Credentials = CredentialCache.DefaultCredentials; 
client.Proxy = wp;
SlevenRobbert01 commented 1 year ago

I think this is a VS 2022 for mac building issue. The firebase-components are needed in the cache library. When they aren't there it tries to download and move them in this directory. Problem is, it cannot connect to the https://dl.google.com because it ignors our proxyserver. When you download the package manualy in for example chrome (does use proxyserver), and place them in the cache lib, then the build works. This is the workaround we use now, but this is not the appropriate way.