Can't build Android app using crashlytics behind VPN and proxy - android-studio

As a teleworker I use a VPN with a proxy.pac (config file is available at http://proxy.mycompany.com/proxy.pac).
To update packages Android SDK Manager, the following proxy settings work properly:
HTTP Proxy Server: proxy.mycompany.com
HTTP Proxy Port: 80
In Android Studio I work on an Android-Gradle project using crashlytics. I have set the same parameters in Proxy HTTP.
A gradle assembleDebug command fails when checking crashlytics apikey:
:myproject-project:compileDebugNdk UP-TO-DATE
:myproject-project:preBuild
:myproject-project:preDebugBuild
:myproject-project:checkDebugManifest
:myproject-project:prepareDebugDependencies
:myproject-project:compileDebugAidl UP-TO-DATE
:myproject-project:compileDebugRenderscript UP-TO-DATE
:myproject-project:generateDebugBuildConfig UP-TO-DATE
:myproject-project:processDebugManifest UP-TO-DATE
> Building 32% > :myproject-project:crashlyticsCleanupResourcesDebug
then after timeout:
ERROR - Crashlytics Developer Tools error.
com.crashlytics.reloc.org.apache.http.conn.HttpHostConnectException: Connect to api.crashlytics.com:443 [api.crashlytics.com/54.225.193.37, api.crashlytics.com/54.243.69.50, api.crashlytics.com/54.243.106.90, api.crashlytics.com/54.243.136.142, api.crashlytics.com/54.243.186.185, api.crashlytics.com/107.21.114.251, api.crashlytics.com/184.72.240.69, api.crashlytics.com/54.225.68.102] failed: Connection timed out: connect
at com.crashlytics.reloc.org.apache.http.impl.conn.HttpClientConnectionOperator.connect(HttpClientConnectionOperator.java:138)
...
I have tried to set gradle properties in ~/.gradle/gradle.properties file:
systemProp.http.proxyHost=proxy.mycompany.com
systemProp.http.proxyPort=80
... but it not seems to be a great idea as I have a warning in HTTP Proxy settings (those settings are obsolete).
I have ask people from network to snif what happens, and there are access failure on URLs like http://dl-ssl.google.com (same that are used in Android SDK manager), or EC2 on Amazon (possibly used by crashlytics, isn't it?).
Of course all this runs perfectly when I'm directly connected in my company's LAN.
Any idea of what could happen? Any workaround?
Thanks for support. Jean
EDIT:
Solution is to set https proxy server and port in ~/.gradle/gradle.properties file. In my case, http parameters seems useless.
systemProp.https.proxyHost=proxy.mycompany.com
systemProp.https.proxyPort=80
Thanks for you help!

Hemal from Crashlytics here. Can you set https.proxyHost and https.proxyPort? In addition, if you have one, go ahead and set https.proxyUser and https.proxyPassword as well! This should take care of it for ya :)

Related

I updated Android Studio and now gradle project sync fails

I updated Android Studio and now I get these errors:
1. Gradle project sync failed. Basic functionality (e.g. editing, debugging) will not work properly.
2. Unable to tunnel through proxy. Proxy returns "HTTP/1.1 403 Request blocked by Privoxy"
I add this line "systemProp.http.nonProxyHosts=*|localhost" in gradle.properties. Works !!!
Just 1.close your IDE(Android Studio) 2.delete .gradle folder in C:/Users/Your User.gradle in Windows and 3.open your IDE and enjoy
Updated: 2020/04/21
this problem could be fixed by delete gradle.properties file in C:/Users/Your User/.gradle folder
following option solved "Unable to tunnel through proxy. Proxy returns "HTTP/1.1 403 Request blocked by Privoxy" issue
In Android Studio: From the menu bar, click File > Settings (on macOS, click Android Studio > Preferences). In the left pane, click Appearance & Behavior > System Settings > HTTP Proxy. Select No proxy radio button.
deleted gradle.properties file in C:/Users/Your User/.gradle folder
In my case I was using two proxies at a time (even though I disabled first)
If you have a $HOME/.gradle/gradle.properties files, make sure your proxy matched the content of this file.
then:
Prefer a proxy [that bypasses the link giving 403]
Or a strong protocol of VPN (Kerio, ...)
(Discovered it by running with --debug option

How to run sdkmanager behind a proxy?

At my workplace, we have a corporate proxy that signs every incoming connections and we need to authenticate to be able to connect to Internet. I've configured the proxy in way too many places, and I got most software to use it. Now, the only program left (for now) that disrespect my config is sdkmanager. So, how do I make sdkmanager respect my proxy/authentication/certificate config?
sdkmanager
Warning: File /home/users/n.gendron/.android/repositories.cfg could not be loaded.
Warning: java.net.ConnectException: Connection timed out (Connection timed out)
Warning: Failed to download any source lists!
[=======================================] 100% Computing updates...
Android Studio / Appearance & Behaviour / System Settings / HTTP Proxy is correctly configured, and Check connection says Connection successful.
Android Studio / Appearance & Behaviour / System Settings / Android SDK does fetch updates without errors. I can even install new Android SDK Platforms.
Android Studio / Tools / Server Certificates has the correct certificate imported
http_proxy, https_proxy and no_proxy are correctly configured in my .profile.
Certificate is added to multiple keystores with sudo /usr/lib/jvm/default-java/bin/keytool -importcert -file /etc/ssl/certs/guardianCA.pem -keystore /usr/lib/jvm/default-java/jre/lib/security/cacerts.
~/.android/androidtool.cfg has yet another copypasta of my settings
I guess it's too late for a reply, I was going through the same problem. So answering now so that others can get help from it.
Basically SDK manager proxy hasn't been set so using command line proxy tunneling is helpful in this case.
This post has been helpful for me installing android command line tools using sdkmanager on windows.
If all the path variables are set properly
"%ANDROID_HOME%\tools\bin\sdkmanager" "emulator" "platform-tools" "platforms;android-28" "build-tools;28.0.3" "extras;android;m2repository" "extras;google;m2repository" --no_https --proxy=http --proxy_host=10.60.11.11 --proxy_port=8080
or
you can navigate to the directory where sdkmanager.bat file is set it in the path variable, or run this command directly from that location
sdkmanager "emulator" "platform-tools" "platforms;android-28" "build-tools;28.0.3" "extras;android;m2repository" "extras;google;m2repository" --no_https --proxy=http --proxy_host=10.60.11.11 --proxy_port=8080

Android Studio: Gradle Sync failed

I have a problem with Gradle
Gradle sync failed: Could not resolve all dependencies for configuration ':app:debugRuntimeClasspath'.
Could not determine artifacts for com.android.support:appcompat-v7:25.1.1
Could not get resource 'https://maven.google.com/com/android/support/appcompat-v7/25.1.1/appcompat-v7-25.1.1.aar'.
Could not HEAD 'https://maven.google.com/com/android/support/appcompat-v7/25.1.1/appcompat-v7-25.1.1.aar'.
Connect to maven.google.com:443 [maven.google.com/216.58.205.163] failed: Connection timed out: connect
Connection timed out: connect
Consult IDE log for more details (Help | Show Log) (38m 44s 794ms)
I have not used Android Studio for three months, so I think the problem is related maybe to some not uploaded configuration files. Or what else?
Thank you.
You can't connect to https://maven.google.com, you have a timeout.
Check your internet connection
Check your firewall / proxy / gateway
Just type https://maven.google.com in your browser and make sure it's working

Proxy configuration for OpenShift Origin

I am setting up an OpenShift origin server. The configurations I do heavily relies on the walkthrough description:
https://github.com/openshift/origin/blob/master/examples/sample-app/README.md
After creating a project, I add a new app like this (successfully):
oc new-app centos/ruby-22-centos7~https://github.com/openshift/ruby-hello-world.git
OpenShift tries to build immediatelly, only to fail as follows:
F0222 15:24:58.504626 1 builder.go:204] Error: build error: fatal: unable to access 'https://github.com/openshift/ruby-hello-world.git/': Failed connect to github.com:443; Connection refused
I consulted the documentation about the proxy configuration:
https://docs.openshift.com/enterprise/3.0/admin_guide/http_proxies.html#git-repository-access
Concluded that I can simply edit the YAML descriptor for this specific app to include my corporate proxy.
...
source:
type: Git
git:
uri: "git://github.com/openshift/ruby-hello-world.git"
httpProxy: http://proxy.example.com
httpsProxy: https://proxy.example.com
...
With that change the build proceeds.
Can the HTTP proxy be configured system wide?
Note: again, I simply downloaded the binaries (client, server), did not install via ansible. And I did not find relevant properties openshift.local.config folder, inside my server binary folder.
After some time I now know enough to answer my own question.
There are two places where one needs to deal with corporate proxy settings.
Docker
This thread will tell you what to do in detail:
Cannot download Docker images behind a proxy
In my case on RHEL 7.2 I needed to edit this file: /etc/sysconfig/docker
I had to add the following entries:
HTTP_PROXY="http://proxy.company.com:4128"
HTTPS_PROXY="http://proxy.company.com:4128"
Then a restart of the docker service was necessary.
Origin Proxy
What I missed originally was the place to configure our corporate proxy settings. Currently I have a cluster (1 master, 1 node) installed via ansible.
These are the relevant files to edit on the servers:
* /etc/sysconfig/origin-master
* /etc/sysconfig/origin-node
There already placeholders in this file:
#NO_PROXY=master.example.com
#HTTP_PROXY=http://USER:PASSWORD#IPADDR:PORT
#HTTPS_PROXY=https://USER:PASSWORD#IPADDR:PORT
Documentation:
https://docs.openshift.org/latest/install_config/http_proxies.html

Perforce Connection Failing for Mondrian Source Code Repository

I am attempting to follow http://mondrian.pentaho.com/documentation/developers_guide.php in the download and compilation of the Mondrian source code.
I have installed the P4V client from www.perforce.com/downloads/complete_list on a fresh install of Windows 7 and configured it for:
host: perforce.eigenbase.org
port: 1666
All I seem to be able to get is "TCP Connection to perforce.eigenbase.org:1666 failed. connect: 72.14.190.177:1666: WSAECONNREFUSED"
I did also attempt to "telnet perforce.eigenbase.org 1666" and received the same type of error.
Has the repository moved contrary to the documentation? or am I using the wrong Perforce Client?
Any provable direction would be appreciated.
I think that mondrian is now hosted on github, it was migrated from perforce a few months ago. Maybe ping them to update the doco..

Resources