This document is for PolyNetSDK version 3 for Android.
Unable to find valid certification path to requested target
One possible error that could happen during the integration process is that Gradle is unable to find valid certification path to requested target
Gradle console view:
Error:Execution failed for task ':sdk:uploadArchives'. > Could not publish configuration 'archives' > Failed to deploy artifacts: Could not transfer artifact com.system73.polynet:polynet-android-sdk:aar:2.0.0 from/to remote (https://dev.artifacts.s73cloud.com/repository/maven-s73-releases/): sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
This error occurs because Android Studio doesn't trust the DST Root CA X3 certification authority. This CA was added to root CAs of the Java Development Kit in version 8 update 101, as described here
Android Studio comes with an embedded JDK newer than the mentioned version (JDK 8 update 112) so it should trust this CA by default, but for some reason it doesn't.
One possible solution to this problem is the use of an external JDK instead of the one embedded with the Android Studio. To use an external JDK:
Install or update your system to the latest available version of JDK 8. For example, in Ubuntu run the following in a terminal:
sudo apt update sudo apt install openjdk-8-jdk
Open the Demo App project in Android Studio and go to the menu "File -> Project Structure...". A new dialog called "Project Structure" will show up
In the dialog "Project Structure", under the left menu, choose "SDK Location". In the section "JDK location", uncheck the option "Use embedded JDK (recommended)" and then choose the location of your system's JDK 8 by clicking the button with the 3 dots "...". For instance, the location (assuming a Debian based host) for the OpenJDK 8 installed in step 1 is:
NOTE: copying and pasting this path in the text box will probably not work; use the 3 dots button to locate the folder manually.
Click OK to confirm the JDK 8 location and then click OK again in the dialog "Project Structure".
Make the project again, using the option from the menu "Build -> Make Project".