How to solve no conscrypt_openjdk_jni in java.library.path error?

java -Xmx2048m -Djava.library.path="out/host/linux-x86/lib64" \
    -jar out/host/linux-x86/framework/signapk.jar \
    -w build/target/product/security/platform.x509.pem \
    build/target/product/security/platform.pk8 \
    FileNeedSign.apk FileNeedSign_Signed.apk

I'm using Jetty, Kotlin, Java 8, and Maven. My solution was twofold. First in pom.xml, add Conscrypt:

<dependency>
    <groupId>org.conscrypt</groupId>
    <artifactId>conscrypt-openjdk</artifactId>
    <version>2.2.1</version>
    <classifier>linux-x86_64</classifier>
</dependency>

Note the <classifier> which needs to be right for your operating system. Pick one from the list here: https://github.com/google/conscrypt/

I like to put my configuration right in the code. Flame me if you like. I followed the instructions here: https://www.eclipse.org/jetty/documentation/current/configuring-ssl.html#conscrypt So right before setting up Jetty's sslContextFactory, I had to add:

    Security.addProvider(new OpenSSLProvider())

then after:

    // SSLv2Hello and SSLv3 are outdated and insecure.
    // TLSv1.3 works with Conscrypt, but not Java 8!
    sslContextFactory.setExcludeProtocols("SSLv2Hello", "SSLv3", "TLSv1.3")
    sslContextFactory.setProvider("Conscrypt");

I think that's what cleared it up. I made a lot of changes today.

I had a separate issue which was that my localhost SSL certificate was invalid. I started with this: Can you use a service worker with a self-signed certificate? but ended up grabbing a cert from a server and editing my /etc/hosts file to make localhost look like that server.