Xamarin android App Deployment failing with error

2019-08-02 21:06发布

Xamarin App Deployment failing with error "apksigner.BAT" exited with code 2 .

JDK version 1.8.162

7条回答
疯言疯语
2楼-- · 2019-08-02 21:45

As others found, it's a conflict that occurs when you have a newer version of Java installed, such as JDK 9.

This shouldn't really be necessary but here is a workaround: Create a new batch file with the below content (update paths as necessary). You want to set JAVA_HOME so it points to the older version of Java.

Xamarin.bat:

@echo off
set JAVA_HOME=C:\Program Files (x86)\Java\jdk1.8.0_161
set PATH=%JAVA_HOME%\bin;%PATH%

cd "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\"
start devenv.exe
查看更多
乱世女痞
3楼-- · 2019-08-02 21:48

I recently get an old poject from a client. It was giving same error in Visual Studio for Windows. In Visual Studio for Mac it was giving 1 error without displaying any Error Message.

The reason behind the error was that the client have specified a signing key which is not available on my system.

On Mac I just have to uncheck the apk signing option.

while on Windows I have to edit the csproj file to remove the signing key. Now the project builds successfully.

查看更多
成全新的幸福
4楼-- · 2019-08-02 21:49

Try downgrading the JDK to 1.8.131.

i faced the problems with 1.8.161 and 1.8.162.

If u are using JDK 9, then downgrade to JDK-8

查看更多
倾城 Initia
5楼-- · 2019-08-02 21:49

In addition to JDK related answers above which is correct, also try to check PATH variable. There have to be latest installed JDK version. Solved my problem after days of checking different IDE's, machines and devices.

查看更多
该账号已被封号
6楼-- · 2019-08-02 21:56

Uninstalling JDK 9.x fixed it for me.

That Android Settings were pointing a JDK 8.x made no difference. JDK 9.x had to be removed to fix the issue.

查看更多
不美不萌又怎样
7楼-- · 2019-08-02 22:03

I got the same error when building a Xamarin.Android app on Visual Studio.

It was caused by having migrated my keystore from JKS to PKCS12 format because

keytool.exe -list -v -keystore <path to my keystore>

kept giving me the following Warning: The JKS keystore uses a proprietary format. It is recommended to migrate to PKCS12 which is an industry standard format.

Bad idea to migrate, it appears apksigner.BAT requires the keystore be in the JKS format. I solved this issue by reverting back to my debug.keystore.old

查看更多
登录 后发表回答