Ubuntu 18.04 Java InvalidAlgorithmParameterException

# Ubuntu 18.04 and various Docker images such as openjdk:9-jdk throw exceptions when
# Java applications use SSL and HTTPS, because Java 9 changed a file format, if you
# create that file from scratch, like Debian / Ubuntu do.
# Before applying, run your application with the Java command line parameter
# java -Djavax.net.ssl.trustStorePassword=changeit ...
# to verify that this workaround is relevant to your particular issue.
# The parameter by itself can be used as a workaround, as well.
# 0. First make yourself root with 'sudo bash'.
# 1. Save an empty JKS file with the default 'changeit' password for Java cacerts.
# Use 'printf' instead of 'echo' for Dockerfile RUN compatibility.
/usr/bin/printf '\xfe\xed\xfe\xed\x00\x00\x00\x02\x00\x00\x00\x00\xe2\x68\x6e\x45\xfb\x43\xdf\xa4\xd9\x92\xdd\x41\xce\xb6\xb2\x1c\x63\x30\xd7\x92' > /etc/ssl/certs/java/cacerts
# 2. Re-add all the CA certs into the previously empty file.
/var/lib/dpkg/info/ca-certificates-java.postinst configure

Android를 빌드하다가 만난 에러.

Java에서 https를 통해 파일을 다운받으려는 경우, https로 통신을 하는 경우에 발생한다. 단순히 이 에러로만 검색해서 나오는 자료들로는 이 문제를 해결할 수 없다. 위 gist를 그대로 실행하면 문제를 해결할 수 있다. (stackoverflow link)

building your project, you need to accept the license agreements and complete the installation of the missing components using the Android Studio SDK Manager. 라는 에러를 만났다면, yes | sdkmanager --licenses 명령어를 사용하자.

여기서 sdkmanager에서 javax~~xml~~을 찾을 수 없다고 한다면 openjdk를 purge하고 oracle jdk로 갈아타자.

Leave a Reply