AndroidX icon indicating copy to clipboard operation
AndroidX copied to clipboard

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

Open SlevenRobbert01 opened this issue 3 years ago • 4 comments

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

  • create xamarin.android project
  • add firebase packages
  • build

Did you find any workaround?

No response

Relevant log output

No response

SlevenRobbert01 avatar Jan 16 '23 15:01 SlevenRobbert01

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

dellis1972 avatar Jan 16 '23 15:01 dellis1972

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

jpobst avatar Jan 17 '23 01:01 jpobst

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

var wp = WebRequest.DefaultWebProxy;
wp.Credentials = CredentialCache.DefaultCredentials; 
client.Proxy = wp;

dellis1972 avatar Jan 17 '23 10:01 dellis1972

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.

SlevenRobbert01 avatar Jan 17 '23 11:01 SlevenRobbert01