Android Studio: Gradle Sync failed - android-studio

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

Related

Gradle build is getting failed while running command build all

Download https //jcenter.bintray.com/org/apache/commons/commons-parent/11/commons-parent-11.pom
BUILD FAILED
Total time 1 mins 55.436 secs
FAILURE Build failed with an exception.
What went wrong ?
A problem occurred configuring root project native.
Could not resolve all dependencies for configuration classpath .
Could not download artifact com.android.tools.build gradle 0.14.4 gradle.jar
Could not GET https //jcenter.bintray.com/com/android/tools/build/gradle/0.14.4/gradle-0.14.4.jar
Connection to https //d29vzk4ow07wi7.cloudfront.net refused
This is because the server does not have internet access to download the gradle files.
You either need to give the server internet access to get the gradle files or manually download them, put them on a HTTP server and point the gradle-wrapper.properties for each application to the file location.
Can also try pointing to a local directory but I am not sure if that will work.
gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-2.1-all.zip

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

Composer update does not run

When i run composer update it fails showing error:
[Composer\Downloader\TransportException]
The "https://packagist.org/packages.json" file could not be downloaded: failed to open stream:
Connection refused
If i visit the URL from my browser it goes through, when i try to wget or curl the URL from my terminal it shows error:
--2017-02-05 20:41:58-- https://packagist.org/packages.json
Connecting to 127.0.0.1:8888... failed:
Connection refused.
--2017-02-05 20:41:58-- https://packagist.org/packages.json
Connecting to 127.0.0.1:8888... failed: Connection refused.
I think its something with proxy connection, but then i can't seem to solve the issue.
Bellow is the full trace if i run composer update -vv:
Reading ./composer.json
Loading config file ./composer.json
Checked CA file /etc/ssl/certs/ca-certificates.crt: valid
Executing command (/var/www/gidiscrap): git branch --no-color --no- abbrev -v
Cannot create cache directory /home/oluwaslim/.composer/cache/repo/https---packagist.org/, or directory is not writable. Proceeding without cache
Cannot create cache directory /home/oluwaslim/.composer/cache/files/, or directory is not writable. Proceeding without cache
Failed to initialize global composer: Composer could not find the config file: /home/oluwaslim/.composer/composer.json
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
Reading /var/www/gidiscrap/vendor/composer/installed.json
Running 1.3.2 (2017-01-27 18:23:41) with PHP 7.0.13-0ubuntu0.16.04.1 on Linux / 4.4.0-59-generic
Loading composer repositories with package information
Downloading https://packagist.org/packages.json using proxy 127.0.0.1:8888
Downloading https://packagist.org/packages.json using proxy 127.0.0.1:8888
Downloading https://packagist.org/packages.json using proxy 127.0.0.1:8888
[Composer\Downloader\TransportException]
The "https://packagist.org/packages.json" file could not be downloaded: failed to open stream: Connection refused
Exception trace:
() at phar:///usr/local/bin/composer/src/Composer/Util/RemoteFilesystem.php:489
Composer\Util\RemoteFilesystem->get() at phar:///usr/local/bin/composer/src/Composer/Util/RemoteFilesystem.php:101
Composer\Util\RemoteFilesystem->getContents() at phar:///usr/local/bin/composer/src/Composer/Repository/ComposerRepository.php:665
Composer\Repository\ComposerRepository->fetchFile() at phar:///usr/local/bin/composer/src/Composer/Repository/ComposerRepository.php:479
Composer\Repository\ComposerRepository->loadRootServerFile() at phar:///usr/local/bin/composer/src/Composer/Repository/ComposerRepository.php:258
Composer\Repository\ComposerRepository->hasProviders() at phar:///usr/local/bin/composer/src/Composer/DependencyResolver/Pool.php:99
Composer\DependencyResolver\Pool->addRepository() at phar:///usr/local/bin/composer/src/Composer/Installer.php:376
Composer\Installer->doInstall() at phar:///usr/local/bin/composer/src/Composer/Installer.php:223
Composer\Installer->run() at phar:///usr/local/bin/composer/src/Composer/Command/UpdateCommand.php:158
Composer\Command\UpdateCommand->execute() at phar:///usr/local/bin/composer/vendor/symfony/console/Command/Command.php:257
Symfony\Component\Console\Command\Command->run() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:850
Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:193
Symfony\Component\Console\Application->doRun() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:227
Composer\Console\Application->doRun() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:124
Symfony\Component\Console\Application->run() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:100
Composer\Console\Application->run() at phar:///usr/local/bin/composer/bin/composer:54
require() at /usr/local/bin/composer:24
Help would be appriciated! I can't seem to get past this error
Am on Ubuntu Linux 16.04, and below is what i had to do to fix the issue, as i mentiond earlier its some problem with proxy settings.
Step 1
Goto System settings
Network
Network proxy
Change it to none
finally click Apply system wide
Step 2
Open terminal and type the following command.
unset https_proxy && unset socks_proxy && unset ftp_proxy
Finally restart your system. The solution above got the issue solved for me.
The line using proxy 127.0.0.1:8888 suggest a problem with your system. I can guess that's a really aggressive antivirus. You should have no reason to connect to localhost on port 8888 unless you have to connect through proxy. What can you do? Check the antivirus settings and turn off checks for secure connections over HTTPS.

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

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 :)

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