“Java.exe”以代码 1 退出(Proguard 问题)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/38147828/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-03 03:10:16  来源:igfitidea点击:

"Java.exe" exited with code 1 (Proguard issue)

javaandroidxamarinproguard

提问by Fran_gg7

I get the following error when I build my Xamarin.Android app in Release.

在 Release 中构建 Xamarin.Android 应用程序时出现以下错误。

"Java.exe" exited with code 1

Here is the output...

这是输出...

...    
1> java.io.IOException: Can't read [C:\Users\FranciscoJavier\AppData\Local\Android\android-sdk\platforms\android-24\android.jar] (Can't process class [java/nio/charset/CharsetDecoder.class] (Unsupported class version number [52.0] (maximum 51.0, Java 1.7)))
1> at proguard.InputReader.readInput(InputReader.java:230)
1> at proguard.InputReader.readInput(InputReader.java:200)
1> at proguard.InputReader.readInput(InputReader.java:178)
1> at proguard.InputReader.execute(InputReader.java:100)
1> at proguard.ProGuard.readInput(ProGuard.java:196)
1> at proguard.ProGuard.execute(ProGuard.java:78)
1> at proguard.ProGuard.main(ProGuard.java:492)
1> Caused by: java.io.IOException: Can't process class [java/nio/charset/CharsetDecoder.class] (Unsupported class version number [52.0] (maximum 51.0, Java 1.7))
1> at proguard.io.ClassReader.read(ClassReader.java:112)
1> at proguard.io.FilteredDataEntryReader.read(FilteredDataEntryReader.java:87)
1> at proguard.io.JarReader.read(JarReader.java:65)
1> at proguard.io.DirectoryPump.readFiles(DirectoryPump.java:65)
1> at proguard.io.DirectoryPump.pumpDataEntries(DirectoryPump.java:53)
1> at proguard.InputReader.readInput(InputReader.java:226)
1> ... 6 more
1> Caused by: java.lang.UnsupportedOperationException: Unsupported class version number [52.0] (maximum 51.0, Java 1.7)
1> at proguard.classfile.util.ClassUtil.checkVersionNumbers(ClassUtil.java:140)
1> at proguard.classfile.io.LibraryClassReader.visitLibraryClass(LibraryClassReader.java:89)
1> at proguard.classfile.LibraryClass.accept(LibraryClass.java:301)
1> at proguard.io.ClassReader.read(ClassReader.java:86)
1> ... 11 more
1> Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8
1>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2118,3): error MSB6006: "java.exe" exited with code 1.
1>Done executing task "Proguard" -- FAILED.
1>Done building target "_CompileToDalvikWithDx" in project "Elfo.VisionShop.Droid.csproj" -- FAILED.
1>
1>Build FAILED.

Reading the output messages it seems there is a problem with ProGuard, somebody know what can I do?

阅读输出消息似乎 ProGuard 有问题,有人知道我该怎么办吗?

回答by Oleg A

Just update proguard from official site http://proguard.sourceforge.net/(replace folder in $SDK_DIR/tools/proguard/)

只需从官方网站http://proguard.sourceforge.net/更新 proguard (替换 $SDK_DIR/tools/proguard/ 中的文件夹)

回答by giannisf

You can see the problem here:

你可以在这里看到问题:

Caused by: java.io.IOException: Can't process class [java/nio/charset/CharsetDecoder.class] (Unsupported class version number [52.0] (maximum 51.0, Java 1.7))

Solution:Change your Java target to 7 (1.7).

解决方案:将您的 Java 目标更改为 7 (1.7)。

回答by Manohar

**Error : while running app “Java.exe” exited with code**

I resolved this by manually overriding the java heap size: In Visual Studio:

我通过手动覆盖 java 堆大小解决了这个问题:在 Visual Studio 中:

  1. Right-click on Project
  2. Click on Android properties
  3. Click on Android Options
  4. Select Advanced tabthen Advanced android build settings
  5. Set Java Max Heap Size to 1G (or larger if needed)
  1. 右键单击项目
  2. 点击安卓属性
  3. 点击安卓选项
  4. 选择Advanced 选项卡,然后选择Advanced android build settings
  5. 将 Java Max Heap Size 设置为 1G(或根据需要更大)

The project now builds.

项目现在建立。

回答by tretom

Having the same problem, for me the following worked (well it's a specific situation causing this error - might be not the only one):

遇到同样的问题,对我来说,以下工作有效(这是导致此错误的特定情况 - 可能不是唯一的):

Set Build Log verbosity to Detailed: in VS2017 -> Tools -> Options -> Projects and Solutions -> Build and Run ->MSBuild project build output verbosity -> Detailed (minimum)

将构建日志详细程度设置为详细:在 VS2017 中 -> 工具 -> 选项 -> 项目和解决方案 -> 构建和运行 ->MSBuild 项目构建输出详细程度 -> 详细(最低)

Start a build. In output log (eg. in output window) search for

开始构建。在输出日志中(例如在输出窗口中)搜索

proguard.ParseException:

proguard.ParseException:

if the log contains something like:

如果日志包含以下内容:

proguard.ParseException: Unknown option '′╗┐-keep' in line 1 of file 'proguard.cfg'

proguard.ParseException: 文件 'proguard.cfg' 的第 1 行中的未知选项 ''╗┐-keep'

then simply open your file in a text editor and save it without BOM.

然后只需在文本编辑器中打开您的文件并在没有 BOM 的情况下保存它。

eg. in Notepad++ Encoding -> Encode in UTF8 (make sure not to select Encode in UTF8-BOM) ...and save

例如。在 Notepad++ Encoding -> Encode in UTF8 (确保不要选择 Encode in UTF8-BOM) ...并保存

Rebuild your project/solution. It should work - at least it workd for me.

重建您的项目/解决方案。它应该有效 - 至少它对我有效。