"PKIX path building failed" using Gradle with ZScaler - android

recently I'm facing some issues using gradle at our development department.
After our Department switched to ZScaler instead of our old VPN solution, I'm facing issues building our android app projects:
~ gradle clean
> Starting Daemon
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'com.example.app'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:7.0.2.
Required by:
project :
> Could not resolve com.android.tools.build:gradle:7.0.2.
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/7.0.2/gradle-7.0.2.pom'.
> Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/7.0.2/gradle-7.0.2.pom'.
> PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
> Could not resolve com.android.tools.build:gradle:7.0.2.
> Could not get resource 'https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/7.0.2/gradle-7.0.2.pom'.
> Could not GET 'https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/7.0.2/gradle-7.0.2.pom'.
> PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
I'm using a Windows 10 x64 machine
Gradle: 5.6.4
openjdk: 11.0.2 2019-01-15
Kotlin: 1.3.41
Does someone know about this issue?
Thanks in advance!

This is a certificate issue. Get in touch with your it team to setup your VPN.
The issue in my case was it was not allowing to access the online gradle , google plugin repositories.
Maybe they did not whitelist them or it has not been set up in your device

Related

Cordova Android Build Issue: Could not HEAD '...packages...' > Socket Closed error

I cannot get a cordova app to build. Below you can see the stack trace:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all files for configuration ':classpath'.
> Could not resolve org.ow2.asm:asm-analysis:6.0.
Required by:
project : > com.android.tools.build:gradle:3.2.0
> Could not resolve org.ow2.asm:asm-analysis:6.0.
> Could not get resource 'https://maven.google.com/org/ow2/asm/asm-analysis/6.0/asm-analysis-6.0.pom'.
> Could not HEAD 'https://maven.google.com/org/ow2/asm/asm-analysis/6.0/asm-analysis-6.0.pom'.
> Socket closed
> Could not resolve org.ow2.asm:asm-analysis:6.0.
> Could not get resource 'https://jcenter.bintray.com/org/ow2/asm/asm-analysis/6.0/asm-analysis-6.0.pom'.
> Could not HEAD 'https://jcenter.bintray.com/org/ow2/asm/asm-analysis/6.0/asm-analysis-6.0.pom'.
> Socket closed
Anyone have any ideas? I'm not being blocked by a firewall and I'm not behind a proxy. I can't find any resources that help point to why these dependencies won't resolve.
Any help is greatly appreciated. Thanks.
EDIT: I tried a cordova clean and am having a similar issue, just a different package starts off the error stack trace:
$ cordova clean
Android Studio project detected
ANDROID_HOME=/Users/[my user folder]/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home
Subproject Path: CordovaLib
Subproject Path: app
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all files for configuration ':classpath'.
> Could not download gradle-api.jar (com.android.tools.build:gradle-api:3.2.0)
> Could not get resource 'https://maven.google.com/com/android/tools/build/gradle-api/3.2.0/gradle-api-3.2.0.jar'.
> Could not HEAD 'https://maven.google.com/com/android/tools/build/gradle-api/3.2.0/gradle-api-3.2.0.jar'.
> Socket closed
> Could not download sdklib.jar (com.android.tools:sdklib:26.2.0)
> Could not get resource 'https://maven.google.com/com/android/tools/sdklib/26.2.0/sdklib-26.2.0.jar'.
> Could not HEAD 'https://maven.google.com/com/android/tools/sdklib/26.2.0/sdklib-26.2.0.jar'.
> Socket closed
> Could not download repository.jar (com.android.tools:repository:26.2.0)
> Could not get resource 'https://maven.google.com/com/android/tools/repository/26.2.0/repository-26.2.0.jar'.
> Could not HEAD 'https://maven.google.com/com/android/tools/repository/26.2.0/repository-26.2.0.jar'.
> Socket closed
> Could not download jetifier-processor.jar (com.android.tools.build.jetifier:jetifier-processor:1.0.0-alpha10)
> Could not get resource 'https://maven.google.com/com/android/tools/build/jetifier/jetifier-processor/1.0.0-alpha10/jetifier-processor-1.0.0-alpha10.jar'.
> Could not HEAD 'https://maven.google.com/com/android/tools/build/jetifier/jetifier-processor/1.0.0-alpha10/jetifier-processor-1.0.0-alpha10.jar'.
> Socket closed
I found the solution to my problem.
The gradle version the cordova app I'm running is on gradle version 3.0.1 which expects the ndk to have a specific folder in it, that provides some deprecated tooling. An answer in this stack overflow fixes that problem: Error: No toolchains found in the NDK toolchains folder for ABI with prefix: llvm
In addition, the repo lines in the gradle files needed updated to include google() in order to find all the dependencies, making it include all of the following :
mavenCentral()
google()
jcenter()
after that, the project built fine. Probably need to update the gradle version so I don't have to make deprecated stuff work. :/

Failure building Android project with gradle error: "Illegal embedded sign character"

Can't make Android project build with gradle assemble task. I'm getting
What went wrong:
A problem occurred configuring root project 'MyProjectTitle'.
> Could not resolve all files for configuration ':classpath'.
> Could not download javax.activation.jar (com.sun.activation:javax.activation:1.2.0)
> Failed to download SHA1 for resource 'https://nexus.mycompanydomain.com/repository/jcenter-cache/com/sun/activation/javax.activation/1.2.0/javax.activation-1.2.0.jar'.
> Illegal embedded sign character
We are using our own Nexus artifactory repository. It works fine for some colleagues.
Turns out, you need to clean ~/.gradle/caches/ folder.

React Native run-android build fails

I've followed the setup guide for react-native android on Mac OS X. I have the emulator running. When I run react-native run-android I get the following:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
> Could not find any matches for com.android.support:appcompat-v7:23.0.+ as no versions of com.android.support:appcompat-v7 are available.
Searched in the following locations:
file:/Users/hugo/.m2/repository/com/android/support/appcompat-v7/maven-metadata.xml
file:/Users/hugo/.m2/repository/com/android/support/appcompat-v7/
https://jcenter.bintray.com/com/android/support/appcompat-v7/maven-metadata.xml
https://jcenter.bintray.com/com/android/support/appcompat-v7/
Required by:
fuckoff:app:unspecified
> Could not find com.android.support:appcompat-v7:22.2.0.
Searched in the following locations:
file:/Users/hugo/.m2/repository/com/android/support/appcompat-v7/22.2.0/appcompat-v7-22.2.0.pom
file:/Users/hugo/.m2/repository/com/android/support/appcompat-v7/22.2.0/appcompat-v7-22.2.0.jar
https://jcenter.bintray.com/com/android/support/appcompat-v7/22.2.0/appcompat-v7-22.2.0.pom
https://jcenter.bintray.com/com/android/support/appcompat-v7/22.2.0/appcompat-v7-22.2.0.jar
Required by:
fuckoff:app:unspecified > com.facebook.react:react-native:0.11.0
> Could not find com.android.support:support-v4:21.0.3.
Searched in the following locations:
file:/Users/hugo/.m2/repository/com/android/support/support-v4/21.0.3/support-v4-21.0.3.pom
file:/Users/hugo/.m2/repository/com/android/support/support-v4/21.0.3/support-v4-21.0.3.jar
https://jcenter.bintray.com/com/android/support/support-v4/21.0.3/support-v4-21.0.3.pom
https://jcenter.bintray.com/com/android/support/support-v4/21.0.3/support-v4-21.0.3.jar
Required by:
fuckoff:app:unspecified > com.facebook.react:react-native:0.11.0 > com.facebook.fresco:fresco:0.6.1 > com.facebook.fresco:drawee:0.6.1
fuckoff:app:unspecified > com.facebook.react:react-native:0.11.0 > com.facebook.fresco:fresco:0.6.1 > com.facebook.fresco:imagepipeline:0.6.1
I have all the necessary Android SDK packages installed including the build tools and the support repository. I'm noticing that it's looking for a directory in my home called .m2, which doesn't exist. I've never needed Maven to do android development. Do I need to install it to use react-native?
Just to be absolutely safe, I tried updating the android packages using android update sdk --no-ui.
Apparently the software I installed using android weren't the most up to date. Running the update fixed the issue.

How to download gradle manually?

I'm using Android Studio version 1.4 and stuck at "Gradle: resolve dependencies ':app:_releaseCompile'"
I think it cause by proxy (I don't have access to proxy) so i want to know how to download gradle maunally
I've tried all method that I found changing properties file, edit parameters but won't work anyway.
Error log:
Error:A problem occurred configuring project ':app'.
>Could not resolve all dependencies for configuration ':app:_debugUnitTestCompile'.
> Could not resolve junit:junit:4.12.
Required by:
prototype1:app:unspecified
> Could not resolve junit:junit:4.12.
> Could not get resource 'jcenter.bintray.com/junit/junit/4.12/junit-4.12.pom'.
> Could not GET 'jcenter.bintray.com/junit/junit/4.12/junit-4.12.pom'.
> Connection to jcenter.bintray.com refused

Gradle cannot resolve dependencies when Building an Android Studio project

I am used to Eclipse and recently tried to import and build a project in Android Studio using Gradle. For some reason, it is not downloading the dependencies.
Error:A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
> Could not resolve com.squareup.dagger:dagger:1.2.1.
Required by:
nxt-freemarket-lite:app:unspecified
> Could not GET 'https://jcenter.bintray.com/com/squareup/dagger/dagger/1.2.1/dagger-1.2.1.pom'.
> Connection to https://jcenter.bintray.com refused
> Could not resolve com.jakewharton:butterknife:5.1.1.
Required by:
nxt-freemarket-lite:app:unspecified
> Could not GET 'https://jcenter.bintray.com/com/jakewharton/butterknife/5.1.1/butterknife-5.1.1.pom'.
> Connection to https://jcenter.bintray.com refused
> Could not resolve com.squareup.dagger:dagger-compiler:1.2.1.
Required by:
nxt-freemarket-lite:app:unspecified
> Could not GET 'https://jcenter.bintray.com/com/squareup/dagger/dagger-compiler/1.2.1/dagger-compiler-1.2.1.pom'.
> Connection to https://jcenter.bintray.com refused
I can download all the .pom files in my browser. I have tried running Android Studio as Administrator, and disabled my Windows Firewall. Why can't it get these deps?

Categories

Resources