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 ( PKIX path building failed: 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:

  1. 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
  2. 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

    alt text

  3. 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: /usr/lib/jvm/java-8-openjdk-amd64

    NOTE: copying and pasting this path in the text box will probably not work; use the 3 dots button to locate the folder manually.

    alt text

  4. Click OK to confirm the JDK 8 location and then click OK again in the dialog "Project Structure".

  5. Make the project again, using the option from the menu "Build -> Make Project".

Exoplayer 2.9.0+

To ensure bytecode compatibility, the apps may need to add the next code to their gradle settings:

compileOptions {
    targetCompatibility JavaVersion.VERSION_1_8

and set compileSdkVersion and targetSdkVersion to 28.