Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ApkSignerTool issue with Java version

i built my first app in Xamarin (in Visual Studio 2019) and I want to deploy it to my android phone. (I actually dont really want to make the app public - just my phone would do the trick for now. I just dont want to root it.)

I followed these guides:

  • https://learn.microsoft.com/de-de/xamarin/android/deploy-test/release-prep/index?tabs=windows
  • https://learn.microsoft.com/de-de/xamarin/android/deploy-test/signing/index?tabs=windows

But once the archiving process is finished, and I was asked for the password of the 'Signing Identity' I defined before, I get the following error:

Signing packages failed. java.lang.UnsupportedClassVersionError: com/android/apksigner/ApkSignerTool has been compiled by a more recent version of Java Runtime(class file version 53.0), this version of the Java Runtime only recognizes class file versions of up to 52.0

I tried to install all sorts of Java versions (currently I am at 'Java 8 Update 241' and 'JDK 13.0.2') and made sure there is just one Java entry in my PATH variable pointing to the current version.

But it just wont change anything and I am out of Ideas, I hope somebody here can help me.

Thank you very much for your time in advance! Ben

like image 803
Quackerjack Avatar asked Feb 27 '20 20:02

Quackerjack


Video Answer


2 Answers

I faced the same problem. I solved it removing version 30.0.0 (rc2) of android build tools and keep only version 28.0.3. Probably it was a problem with build tools 30 and the latest version of Xamarin, who uses JDK 1.8. I also updated platform tools to version 29.0.6

like image 84
backspace83 Avatar answered Oct 20 '22 10:10

backspace83


Double-check that Java JDK 13.0.2 is selected in the Xamarin preferences:

Visual Studio: Tools > Options > Xamarin > Android Settings > Java Development Kit Location.

enter image description here

Here is a similar thread. You can refer to it.

https://stackoverflow.com/a/36585636/10627299

like image 22
Leon Lu - MSFT Avatar answered Oct 20 '22 09:10

Leon Lu - MSFT