Can you please help me to resolve the Gradle build issue in Android 3.0 ?
I am new with Android Studio. Here are my configurations in the AS 3.0:
gradle->wrapper->gradle-wrapper.properties:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.2.1-all.zip
build.gradle dependencies (Android Plugin for Gradle):
dependencies {classpath 'com.android.tools.build:gradle:3.0.0'}
Stacktrace from Android Studio:
D:\AppiumAutomation\MobileTest>gradlew assemble --stacktrace
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'MobileTest'.
> Could not resolve all files for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:3.0.0.
Required by:
project :
> Could not resolve com.android.tools.build:gradle:3.0.0.
> Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom'.
> Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom'.
> sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification pat
h to requested target
> Could not resolve com.android.tools.build:gradle:3.0.0.
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom'.
> Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom'.
> sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification pat
h to requested target
It's a problem related to Android Studio 3.0 and the corporate networks. I had the same problem.
Error:Could not resolve all files for configuration ':app:debugAndroidTestRuntimeClasspath'.
> Could not resolve com.android.support.test:runner:1.0.1.
Required by:
project :app
> Could not resolve com.android.support.test:runner:1.0.1.
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/support/test/runner/1.0.1/runner-1.0.1.pom'.
> Could not GET 'https://dl.google.com/dl/android/maven2/com/android/support/test/runner/1.0.1/runner-1.0.1.pom'.
> sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
> Could not resolve com.android.support.test.espresso:espresso-core:3.0.1.
Required by:
project :app
> Could not resolve com.android.support.test.espresso:espresso-core:3.0.1.
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/support/test/espresso/espresso-core/3.0.1/espresso-core-3.0.1.pom'.
> Could not GET 'https://dl.google.com/dl/android/maven2/com/android/support/test/espresso/espresso-core/3.0.1/espresso-core-3.0.1.pom'.
> sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
I leave you 2 solutions:
1rst: You must add certificates manually to your java security certs (used by Android):
C:\Program Files\Android\Android Studio\jre\jre\lib\security\cacerts
Go to:
C:\Program Files\Android\Android Studio\jre\jre\bin
Download the Certificate you need (just copy the URL with the problem and paste it into <remote_host_name>
):
keytool -J-Dhttps.proxyHost=<proxy_hostname> -J-Dhttps.proxyPort=<proxy_port> -printcert -rfc -sslserver <remote_host_name:remote_ssl_port> > <name.cer>
Example:
C:\Program Files\Android\Android Studio\jre\jre\bin>keytool -J-Dhttps.proxyHost= proxy.mycompany.com -J-Dhttps.proxyPort=80 -printcert -rfc -sslserver https://dl.google.com/dl/android/maven2/com/android/support/test/runner/1.0.1/runner-1.0.1.pom > maven2.cer
And run the command:
keytool -import -noprompt -trustcacerts -keystore ..\lib\security\cacerts -importcert -alias <AliasName> -file <name.cer> -storepass <cacertsPassword>
If you never changed the password of cacerts the default one is changeit
:
Example:
C:\Program Files\Android\Android Studio\jre\jre\bin>keytool -import -noprompt -trustcacerts -keystore ..\lib\security\cacerts -importcert -alias Maven -file maven2.cer -storepass changeit
Download the pom entering to the URL site and store it in your local repo:
Ex:
If your missing resoruce is:
https://dl.google.com/dl/android/maven2/com/android/support/test/espresso/espresso-core/3.0.1/espresso-core-3.0.1.pom
Download it and put it in:
C:/Program Files/Android/Android Studio/gradle/m2repository/com/android/support/test/espresso/espresso-core/3.0.1/espresso-core-3.0.1.pom
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With