Error jarsigner: java.time.DateTimeException: Invalid value for MonthOfYear (valid values ​​1 to 12): 0

I get this error when signing Ionic android apk, I'm on Kubuntu 17.04 using Ionic 3 installed by java 8

The error I get is:

Enter Passphrase for keystore: 
updating: META-INF/MANIFEST.MF
adding: META-INF/TEST2.SF
adding: META-INF/TEST2.RSA
signing: AndroidManifest.xml
jarsigner error: java.time.DateTimeException: Invalid value for MonthOfYear (valid values 1 - 12): 0

java version

$ java -version
openjdk version "1.8.0_131"
OpenJDK Runtime Environment (build 1.8.0_131-8u131-b11-2ubuntu1.17.04.3-b11)
OpenJDK 64-Bit Server VM (build 25.131-b11, mixed mode)

Javac

$ javac -version
javac 1.8.0_131

I have Android Studio installed, and it works fine, I tested the source code of the application and ran the emulator without any problems.

+4
source share
2 answers

This problem can be resolved on Debian 9 by installing the correct update alternative for jarsigner, which corresponds to the java and javac versions.

Java version

$ java -version
openjdk version "1.8.0_141"
OpenJDK Runtime Environment (build 1.8.0_141-8u141-b15-1~deb9u1-b15)
OpenJDK 64-Bit Server VM (build 25.141-b15, mixed mode)

Javac version

$ javac -version
javac 1.8.0_141

Jarsigner version

$ sudo update-alternatives --get-selections | grep jarsigner
jarsigner   manual   /usr/lib/jvm/java-8-openjdk-amd64/bin/jarsigner

To install the jarsigner version

$ sudo update-alternatives --config jarsigner
There are 4 choices for the alternative jarsigner (providing /usr/bin/jarsigner).

  Selection    Path                                             Priority   Status
------------------------------------------------------------
  0            /usr/lib/jvm/java-9-openjdk-amd64/bin/jarsigner   1091      auto mode
  1            /usr/bin/gjarsigner-4.9                           1049      manual mode
  2            /usr/bin/gjarsigner-6                             1060      manual mode
* 3            /usr/lib/jvm/java-8-openjdk-amd64/bin/jarsigner   1081      manual mode
  4            /usr/lib/jvm/java-9-openjdk-amd64/bin/jarsigner   1091      manual mode
+2
source

. java - 9.0.1, jdk 1.8.xx . , jdk .

0

Source: https://habr.com/ru/post/1686700/


All Articles