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

13,805

Solution 1

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

Solution 2

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).

Solution 3

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

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

  1. Right-click on Project
  2. Click on Android properties
  3. Click on Android Options
  4. Select Advanced tab then Advanced android build settings
  5. Set Java Max Heap Size to 1G (or larger if needed)

The project now builds.

Solution 4

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)

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

proguard.ParseException:

if the log contains something like:

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

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

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

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

Share:
13,805

Related videos on Youtube

Fran_gg7
Author by

Fran_gg7

Updated on June 04, 2022

Comments

  • Fran_gg7
    Fran_gg7 almost 2 years

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

    "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?

    • Andy Turner
      Andy Turner almost 8 years
      The problem is that you're compiling for Java 8, which isn't supported: Unsupported class version number [52.0] (maximum 51.0, Java 1.7).
    • Fran_gg7
      Fran_gg7 almost 8 years
      Ok but...how can I change this in order to compile with Java 1.7?
    • Andy Turner
      Andy Turner almost 8 years
    • Fran_gg7
      Fran_gg7 almost 8 years
      I do not understand that solution...
    • Fran_gg7
      Fran_gg7 almost 8 years
      I just have checked that I already was using SDK 1.7..., as you can see: s31.postimg.org/xqvxi9tqz/Untitled.png
    • JMD
      JMD about 7 years
      Possible duplicate of Xamarin Android ProGuard Enable
  • giannisf
    giannisf almost 8 years
    install jdk 1.7 change it from File -> Project Structure
  • Fran_gg7
    Fran_gg7 almost 8 years
    Giannisf, I did not understand you...File -> Project from where? VisualStudio? Please give me more details. Thanks a lot in advance :-)
  • giannisf
    giannisf almost 8 years
    @Fran_gg7 In Android Studio. If you are using Xamarin, see this post from the forums forums.xamarin.com/discussion/16210/…
  • Fran_gg7
    Fran_gg7 almost 8 years
    I just have checked that I already was using SDK 1.7..., as you can see: s31.postimg.org/xqvxi9tqz/Untitled.png
  • Felix
    Felix over 7 years
    this worked for me. If you see some error code like -1073740791 in output this should be the solution. -1073740791 is actually 0xC0000409, which is actually Stack buffer overflow, which is ... the site's name. :-)
  • Emil
    Emil over 7 years
    Also make sure that you have latest proguard. default android sdk doesnt have latest proguard. you need to download and manually replace inside android sdk folder
  • Zoe stands with Ukraine
    Zoe stands with Ukraine about 5 years
    You don't need to say that you know the post is old: you can answer a question (assuming it is an actual answer, which this is) whether the post is 2 minutes old, or 2 years old. Updates are periodically needed too
  • Ognjen Babic
    Ognjen Babic about 5 years
    I noticed this error in build log but i could not figure out why it was happening. Thanks a lot for an encoding tip.